Getting Started in Blazor

By Syncfusion®, Inc. · Last updated

What Blazor is and why teams use it, its key features, its place in .NET, versions, real uses, pros and cons, system requirements, installing the .NET SDK, setting up Visual Studio or VS Code, and creating your first Blazor Web App.

What you will learn

  • Explain what Blazor is and why a C# team might choose it
  • Install the .NET 10 SDK and set up Visual Studio or VS Code
  • Create a Blazor Web App and pick an interactivity option
  • Recognise the sample pages the template creates

Blazor Overview

  • Blazor is a web framework from Microsoft for building interactive web apps.
  • You write the app in C# and HTML, not JavaScript.
  • You build the screen from small reusable pieces called components.
  • A component lives in a .razor file. It mixes HTML with C# code.
  • Blazor is part of ASP.NET Core, the web part of .NET.

New to C#? C# is a programming language made by Microsoft. It runs on .NET, a free platform for building apps. This course uses only simple C#, and explains it when it appears.

Real-World Example: Ravi runs a small tea shop in Chennai called Ravi's Tea Shop. He knows C#, but not JavaScript. He wants a web page where customers can see the menu and place an order. Blazor lets him build it in C#.

Press ▶ Run to build Ravi's first page. The code compiles with the real Blazor compiler, right in your browser.

What happened:

  • The top part is HTML. It is what the visitor sees.
  • @shopName puts the value of a C# variable into the page.
  • @foreach is a C# loop. It makes one li for each tea.
  • The @code block holds the C# variables and methods for this component.

Watch the animation. Your .razor file becomes C#, .NET runs it, and the browser shows HTML.

Animation: Home.razor is compiled into C#, .NET runs it, and the browser shows the page. A click goes back to the C# code.

Home.razor HTML + C#

Razor compiler makes a C# class

.NET runs it builds the HTML

Browser Ravi's Tea Shop

Order

a click runs your C# method

You write C# and HTML. Blazor turns it into a page, and runs your C# when the visitor clicks.

Simple lesson: Blazor builds interactive web pages from components written in C# and HTML.

Why Blazor?

  • Most web apps use JavaScript in the browser and another language on the server.
  • That means two languages, two sets of tools, and code written twice.
  • With Blazor, you use C# for both the browser and the server.
  • You can share the same code, such as data classes and checks, between them.
  • Teams that already know C# and .NET can build web apps without learning a JavaScript framework first.

Here is a button in Blazor. The click runs a C# method. No JavaScript is written.

  • @onclick="AddCup" connects the button to the C# method AddCup.
  • When cups changes, Blazor updates the page for you.

Simple lesson: Blazor lets one language, C#, run your whole web app.

Key Features

  • Components. You build the page from small pieces, like MenuItem or OrderButton. You reuse them anywhere.
  • Razor syntax. You mix HTML and C# in one file with the @ sign.
  • Data binding. A text box and a C# variable stay in sync with @bind.
  • Event handling. Clicks and key presses call C# methods, like @onclick.
  • Routing. @page "/order" gives a component its own web address.
  • Dependency injection. Blazor hands services (like a data service) to the components that need them.
  • JavaScript interop. If you need a JavaScript library, C# can call it.

Try two features together. MenuItem is a component. Home uses it three times and passes values to it.

The box opens on MenuItem.razor, the component. Click the Home.razor tab to see it used.

  • [Parameter] marks a value that the parent component can set.
  • Change a price in Home.razor and press ▶ Run again.

Now data binding. Type your name in the box.

  • @bind="name" links the text box to the name variable, both ways.
  • @bind:event="oninput" updates the page on every key press.

Simple lesson: Components, Razor syntax and data binding are the three features you will use every day.

Blazor in the .NET Ecosystem

  • .NET is Microsoft's free, open-source platform. It runs on Windows, macOS and Linux.
  • ASP.NET Core is the part of .NET for web apps and web APIs.
  • Blazor is the part of ASP.NET Core for interactive web user interfaces.
  • Other parts of .NET build other kinds of apps. For example, .NET MAUI builds mobile and desktop apps.
  • All of them use C#, the same libraries, and the same tools.

.NET contains ASP.NET Core, .NET MAUI and console apps. ASP.NET Core contains Blazor, Web APIs and MVC.

.NET (C#, libraries, tools)

ASP.NET Core (web)

Blazor web user interfaces

Web APIs

MVC

SignalR (real-time)

.NET MAUI mobile and desktop apps

Console, games, cloud other kinds of apps

Blazor sits inside ASP.NET Core, which sits inside .NET.

Simple lesson: Blazor is the web user interface part of .NET, so it shares C# and tools with every other .NET app.

Blazor Versions

  • Blazor ships with each new version of .NET, once a year in November.
  • LTS (Long Term Support) versions get 3 years of fixes. STS (Standard Term Support) versions get 2 years.
VersionYearWhat it added for Blazor
.NET Core 3.02019First release: Blazor Server
.NET Core 3.22020Blazor WebAssembly (C# runs inside the browser)
.NET 6 (LTS)2021Hot Reload, faster WebAssembly
.NET 8 (LTS)2023The Blazor Web App template and render modes
.NET 10 (LTS)2025Faster loading, better forms and state, supported until 2028
.NET 11 (STS)2026The newest version, released on 10 November 2026
  • This course uses .NET 10, the current LTS version. Everything you learn also works on .NET 11.
  • .NET 8 and .NET 9 reached end of support on 10 November 2026. Do not start new apps on them.

Every lab on this page runs on real .NET 10 in your browser. Press ▶ Run to see the version.

  • Console.WriteLine prints to the Console pane under the preview.

Simple lesson: Pick the newest LTS version (today, .NET 10) unless you have a reason to use another.

Real-World Applications

Teams use Blazor for many kinds of apps:

  • Business dashboards that show sales, stock and reports.
  • Admin panels for managing users, orders and products.
  • Internal tools such as leave requests, timesheets and approvals.
  • Forms-heavy apps such as insurance claims and bank account opening.
  • Line-of-business apps that replace old desktop apps with web apps.
  • Hybrid apps that use Blazor components inside a .NET MAUI mobile or desktop app.

For Ravi, that could mean a menu page for customers, and an order dashboard for his staff.

Simple lesson: Blazor is most popular for business apps built by teams that already use .NET.

Advantages and Limitations

AdvantagesLimitations
One language (C#) for browser and serverWebAssembly apps download the .NET runtime first, so the first load is slower
Share code and data classes between server and browserSmaller set of ready UI libraries than React
Strong typing catches mistakes before you runSome browser features still need a little JavaScript
Great tools: Visual Studio, debugging, Hot ReloadServer mode needs a live connection to the server
Long-term support from MicrosoftFewer tutorials and job posts than React or Angular

WebAssembly = a fast, low-level format that modern browsers can run. Blazor uses it to run .NET, and your C#, inside the browser.

Simple lesson: Blazor is great when your team knows C#. Plan for the larger first download if you use WebAssembly.

System Requirements

You need these on your computer:

  • Operating system: Windows 10 or 11, macOS, or Linux.
  • The .NET 10 SDK. SDK = Software Development Kit. It has the compiler and the dotnet command.
  • A code editor: Visual Studio 2026 (Windows), or Visual Studio Code (any system).
  • A modern browser: Edge, Chrome, Firefox or Safari.
  • Memory: at least 8 GB of RAM is recommended. Visual Studio needs about 20 GB of disk space.

You do not need anything installed to follow this course. Every lab runs in your browser. Install the tools when you want to build apps on your own computer.

Simple lesson: You need an operating system, the .NET SDK, an editor and a browser.

.NET SDK Installation

  1. Open dotnet.microsoft.com/download in your browser.
  2. Pick .NET 10.0 and download the SDK for your system (not just the "Runtime").
  3. Run the installer and follow the steps.
  4. Open a new terminal window and check the install.

Click Next to see each command. Your version numbers may be a little different.

  • On Windows, Visual Studio can install the SDK for you.
  • On macOS you can also use the installer from the same page. On Linux, use your package manager (for example sudo apt install dotnet-sdk-10.0 on Ubuntu).

Simple lesson: Install the .NET 10 SDK, then run dotnet --version to check it.

Environment Setup

You can use either editor. Both are free for learning.

Visual Studio Setup

Visual Studio 2026 is a full IDE for Windows. IDE = Integrated Development Environment: an editor with a debugger, designer and build tools in one app.

  1. Download Visual Studio 2026 Community from visualstudio.microsoft.com.
  2. Run the Visual Studio Installer.
  3. Tick the workload ASP.NET and web development. It includes the .NET SDK and the Blazor templates.
  4. Click Install, then open Visual Studio.

Visual Studio Code Setup

Visual Studio Code (VS Code) is a lighter editor. It runs on Windows, macOS and Linux.

  1. Install the .NET 10 SDK (see the section above).
  2. Download and install VS Code from code.visualstudio.com.
  3. Open the Extensions view (Ctrl+Shift+X) and install C# Dev Kit from Microsoft. It also installs the C# extension.
  4. Or install it from the terminal:
Visual Studio 2026Visual Studio Code
SystemsWindowsWindows, macOS, Linux
SizeLarge, full IDESmall, add extensions
Best forBig .NET projects, rich debuggingQuick edits, any system

Simple lesson: Use Visual Studio on Windows for the richest tools, or VS Code with C# Dev Kit on any system.

Project Creation

Project Templates

A template is a ready-made starter project. .NET has two main Blazor templates:

TemplateShort nameWhat you get
Blazor Web AppblazorServer + browser in one project. The recommended starting point.
Blazor WebAssembly Standalone AppblazorwasmRuns only in the browser. No .NET server is needed, so you can host it on any static web host.

Interactivity Options

  • Interactivity = how the page reacts to clicks and typing.
  • Blazor calls the choice a render mode. You pick it when you create the project.
OptionWhere your C# runsGood for
None (static)On the server, oncePages that only show content
ServerOn the server, over a live connectionFast first load, intranet apps
WebAssemblyIn the browserApps that work without a constant connection
AutoServer first, then the browserFast first load, then runs in the browser

Watch the animation. In Server mode, every click travels to the server and back. In WebAssembly mode, .NET downloads once, then clicks stay in the browser.

Animation: Server mode sends each click from the browser to the server and back. WebAssembly mode downloads .NET once, then runs in the browser. Interactive Server Interactive WebAssembly

Browser

Server your C# runs

Each click goes to the server and back over a live connection (SignalR).

Server

Browser .NET + your C#

.NET downloads once (.wasm files). After that, clicks stay in the browser.

Server mode keeps your code on the server. WebAssembly mode moves it into the browser.

Interactivity location. The template also asks Per page/component or Global. Per page means only pages you mark become interactive. Global means every page is interactive. Beginners can keep the default, Per page/component.

Using Visual Studio

  1. Open Visual Studio and click Create a new project.
  2. Search for Blazor Web App and click Next.
  3. Type the project name BlazorApp, pick a folder, and click Next.
  4. On Additional information, choose:

    • Framework: .NET 10.0 (Long Term Support)
    • Interactive render mode: Server
    • Interactivity location: Per page/component
    • Keep Include sample pages ticked.
  5. Click Create. Visual Studio makes the project and opens it.

Using .NET CLI

CLI = Command-Line Interface: you type commands instead of clicking. The dotnet command does the same job as the Visual Studio dialog.

Click Next to see each command. Paths and some lines are shortened.

Simple lesson: Start with the Blazor Web App template. Create it with Visual Studio or with dotnet new blazor.

Your New Project

  • The template has made a complete, working Blazor app for you.
  • It has three sample pages: Home, Counter and Weather, and a menu on the left.
  • When you run it, your browser shows this:

Animation: the new Blazor app in a browser. A dark purple menu on the left has Home, Counter and Weather. The page shows Hello, world! The pointer clicks Counter and the count goes up.

https://localhost:7275

BlazorApp

🏠 Home ➕ Counter ☁ Weather

Hello, world! Welcome to your new app.

Counter Current count: 0 Current count: 1

Click me

The new app: a menu on the left and the Home page. Click Counter, then Click me, and the number goes up.

The code box below is a small Blazor project. Open the folders in the Explorer and click a file to read it. The 🔒 files are read-only here.

In the below example, Home.razor is the project's home page, changed for Ravi's shop. Press ▶ Run and click the button.

  • @onclick runs the C# method OrderCup, and the page shows the new number. You will learn every part of this file soon.
  • In the next lesson, you will learn what every file and folder does, and how to run the app on your computer.

Simple lesson: One command gives you a complete app with three sample pages. You will explore its files next.

Common mistakes

MistakeWrong ideaCorrect ideaWhat goes wrong
Installing only the .NET RuntimeThe Runtime is enough to build appsInstall the .NET 10 SDKdotnet new and dotnet run are not found
Using an old terminal after installingNew programs work in open windowsClose and open the terminal again"dotnet: command not found"
Starting a new app on .NET 8 or 9Any .NET version is fineUse .NET 10 (LTS)No more security fixes after November 2026
Choosing the WebAssembly Standalone template by defaultBoth templates are the sameStart with Blazor Web AppYou miss the server features you may need later
Writing the logic in JavaScriptBlazor still needs JavaScript for clicksHandle events in C# with @onclickTwo languages for one small job
Forgetting @ before a C# valueBlazor finds variables by itselfWrite @shopNameThe page shows the word shopName as text

Check Yourself

Exercises

What to Remember

  • Blazor builds interactive web apps from components written in C# and HTML.
  • It is part of ASP.NET Core, inside .NET. Use .NET 10 (LTS).
  • Install the .NET 10 SDK, then Visual Studio 2026 or VS Code with C# Dev Kit.
  • Create a project with the Blazor Web App template: in Visual Studio, or with dotnet new blazor.
  • Pick an interactivity option: None, Server, WebAssembly or Auto.

Next: Project Structure and Running the App