# Getting Started

Course: [Blazor](https://www.devtutorials.ai/learn/blazor) · Section: Foundations
Source: https://www.devtutorials.ai/learn/blazor/foundations/getting-started

> 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.

## 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.

<p>Fresh tea, made to order.</p>

<ul>
      @foreach (var tea in menu)
      {
          <li>@tea</li>
      }
</ul>

@code {
      private string shopName = "Ravi's Tea Shop";
      private string[] menu = { "Masala Tea", "Ginger Tea", "Lemon Tea" };
}
`,
  }}
/>

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.

<figure className="blz-fig">
<svg viewBox="0 0 660 190" role="img" aria-labelledby="fig-blz-flow">
  <title id="fig-blz-flow">Animation: Home.razor is compiled into C#, .NET runs it, and the browser shows the page. A click goes back to the C# code.</title>
  <defs><marker id="blz-a1" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto"><path d="M0 0 L10 5 L0 10 z" style={{ fill: "var(--muted)" }} /></marker></defs>
  <rect className="pur" x="16" y="60" width="130" height="56" rx="10" />
  <text className="t m" x="81" y="84" textAnchor="middle" style={{ fontSize: 13, fontWeight: 700 }}>Home.razor</text>
  <text className="t" x="81" y="103" textAnchor="middle" style={{ fontSize: 11 }}>HTML + C#</text>
  <rect className="org" x="186" y="60" width="130" height="56" rx="10" />
  <text className="t" x="251" y="84" textAnchor="middle" style={{ fontSize: 13, fontWeight: 700 }}>Razor compiler</text>
  <text className="t" x="251" y="103" textAnchor="middle" style={{ fontSize: 11 }}>makes a C# class</text>
  <rect className="grn" x="356" y="60" width="120" height="56" rx="10" />
  <text className="t" x="416" y="84" textAnchor="middle" style={{ fontSize: 13, fontWeight: 700 }}>.NET runs it</text>
  <text className="t" x="416" y="103" textAnchor="middle" style={{ fontSize: 11 }}>builds the HTML</text>
  <rect className="blu" x="516" y="44" width="130" height="88" rx="10" />
  <text className="t" x="581" y="66" textAnchor="middle" style={{ fontSize: 13, fontWeight: 700 }}>Browser</text>
  <text className="t" x="581" y="90" textAnchor="middle" style={{ fontSize: 12 }}>Ravi's Tea Shop</text>
  <rect x="551" y="102" width="60" height="20" rx="5" style={{ fill: "#6d28d9" }}>
    <animate attributeName="opacity" values="1;0.5;1" dur="1.6s" repeatCount="indefinite" />
  </rect>
  <text x="581" y="116" textAnchor="middle" style={{ fill: "#fff", fontSize: 11, fontFamily: "var(--sans)" }}>Order</text>
  <path className="line" d="M146 88 H182" markerEnd="url(#blz-a1)" />
  <path className="line" d="M316 88 H352" markerEnd="url(#blz-a1)" />
  <path className="line" d="M476 88 H512" markerEnd="url(#blz-a1)" />
  <path className="line" d="M581 132 V160 H416 V120" markerEnd="url(#blz-a1)" style={{ strokeDasharray: "5 4" }} />
  <text className="t" x="500" y="176" textAnchor="middle" style={{ fontSize: 11 }}>a click runs your C# method</text>
  <circle r="6" style={{ fill: "#6d28d9" }}>
    <animate attributeName="cx" values="81;251;416;581" dur="3s" repeatCount="indefinite" />
    <animate attributeName="cy" values="40;40;40;40" dur="3s" repeatCount="indefinite" />
  </circle>
</svg>
<figcaption>You write C# and HTML. Blazor turns it into a page, and runs your C# when the visitor clicks.</figcaption>
</figure>

**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.

<p>Cups ordered: @cups</p>

<button @onclick="AddCup">Add one cup</button>

@code {
      private int cups = 0;

      private void AddCup()
      {
          cups++;
      }
}
`,
  }}
/>

- `@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.

`,
    "Components/MenuItem.razor": `<p>@Name: ₹@Price</p>

@code {
      [Parameter] public string Name { get; set; } = "";
      [Parameter] public int Price { get; set; }
}
`,
  }}
/>

- `[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.

<p>Hello, @name! Your tea is on the way.</p>

@code {
      private string name = "Asha";
}
`,
  }}
/>

- `@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.

<figure className="blz-fig">
<svg viewBox="0 0 620 230" role="img" aria-labelledby="fig-blz-eco">
  <title id="fig-blz-eco">.NET contains ASP.NET Core, .NET MAUI and console apps. ASP.NET Core contains Blazor, Web APIs and MVC.</title>
  <rect className="box" x="10" y="10" width="600" height="210" rx="14" />
  <text className="t" x="30" y="36" style={{ fontSize: 15, fontWeight: 700 }}>.NET (C#, libraries, tools)</text>
  <rect className="blu" x="30" y="54" width="360" height="150" rx="12" />
  <text className="t" x="48" y="78" style={{ fontSize: 14, fontWeight: 700 }}>ASP.NET Core (web)</text>
  <rect className="pur" x="48" y="96" width="140" height="90" rx="10" style={{ strokeWidth: 3 }} />
  <text className="t" x="118" y="132" textAnchor="middle" style={{ fontSize: 16, fontWeight: 700 }}>Blazor</text>
  <text className="t" x="118" y="154" textAnchor="middle" style={{ fontSize: 11 }}>web user interfaces</text>
  <rect className="box" x="204" y="96" width="80" height="40" rx="8" />
  <text className="t" x="244" y="121" textAnchor="middle" style={{ fontSize: 12 }}>Web APIs</text>
  <rect className="box" x="294" y="96" width="80" height="40" rx="8" />
  <text className="t" x="334" y="121" textAnchor="middle" style={{ fontSize: 12 }}>MVC</text>
  <rect className="box" x="204" y="146" width="170" height="40" rx="8" />
  <text className="t" x="289" y="171" textAnchor="middle" style={{ fontSize: 12 }}>SignalR (real-time)</text>
  <rect className="grn" x="410" y="54" width="180" height="66" rx="12" />
  <text className="t" x="500" y="84" textAnchor="middle" style={{ fontSize: 14, fontWeight: 700 }}>.NET MAUI</text>
  <text className="t" x="500" y="104" textAnchor="middle" style={{ fontSize: 11 }}>mobile and desktop apps</text>
  <rect className="org" x="410" y="138" width="180" height="66" rx="12" />
  <text className="t" x="500" y="168" textAnchor="middle" style={{ fontSize: 14, fontWeight: 700 }}>Console, games, cloud</text>
  <text className="t" x="500" y="188" textAnchor="middle" style={{ fontSize: 11 }}>other kinds of apps</text>
</svg>
<figcaption>Blazor sits inside ASP.NET Core, which sits inside .NET.</figcaption>
</figure>

**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.

| Version | Year | What it added for Blazor |
|---|---|---|
| .NET Core 3.0 | 2019 | First release: Blazor Server |
| .NET Core 3.2 | 2020 | Blazor WebAssembly (C# runs inside the browser) |
| .NET 6 (LTS) | 2021 | Hot Reload, faster WebAssembly |
| .NET 8 (LTS) | 2023 | The **Blazor Web App** template and render modes |
| .NET 10 (LTS) | 2025 | Faster loading, better forms and state, supported until 2028 |
| .NET 11 (STS) | 2026 | The 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.

<p>Framework: @RuntimeInformation.FrameworkDescription</p>
<p>.NET version: @Environment.Version</p>

@code {
      protected override void OnInitialized()
      {
          Console.WriteLine("Version page loaded.");
      }
}
`,
  }}
/>

- `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

| Advantages | Limitations |
|---|---|
| One language (C#) for browser and server | WebAssembly apps download the .NET runtime first, so the first load is slower |
| Share code and data classes between server and browser | Smaller set of ready UI libraries than React |
| Strong typing catches mistakes before you run | Some browser features still need a little JavaScript |
| Great tools: Visual Studio, debugging, Hot Reload | Server mode needs a live connection to the server |
| Long-term support from Microsoft | Fewer 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.

- 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 2026 | Visual Studio Code |
|---|---|---|
| Systems | Windows | Windows, macOS, Linux |
| Size | Large, full IDE | Small, add extensions |
| Best for | Big .NET projects, rich debugging | Quick 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:

| Template | Short name | What you get |
|---|---|---|
| **Blazor Web App** | `blazor` | Server + browser in one project. The recommended starting point. |
| **Blazor WebAssembly Standalone App** | `blazorwasm` | Runs 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.

| Option | Where your C# runs | Good for |
|---|---|---|
| **None** (static) | On the server, once | Pages that only show content |
| **Server** | On the server, over a live connection | Fast first load, intranet apps |
| **WebAssembly** | In the browser | Apps that work without a constant connection |
| **Auto** | Server first, then the browser | Fast 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.

<figure className="blz-fig">
<svg viewBox="0 0 640 230" role="img" aria-labelledby="fig-blz-modes">
  <title id="fig-blz-modes">Animation: Server mode sends each click from the browser to the server and back. WebAssembly mode downloads .NET once, then runs in the browser.</title>
  <text className="t" x="160" y="22" textAnchor="middle" style={{ fontSize: 14, fontWeight: 700 }}>Interactive Server</text>
  <text className="t" x="480" y="22" textAnchor="middle" style={{ fontSize: 14, fontWeight: 700 }}>Interactive WebAssembly</text>
  <line x1="320" y1="10" x2="320" y2="220" style={{ stroke: "var(--line)", strokeWidth: 1.5 }} />
  <rect className="blu" x="20" y="60" width="100" height="70" rx="10" />
  <text className="t" x="70" y="100" textAnchor="middle" style={{ fontSize: 13, fontWeight: 700 }}>Browser</text>
  <rect className="grn" x="200" y="60" width="100" height="70" rx="10" />
  <text className="t" x="250" y="92" textAnchor="middle" style={{ fontSize: 13, fontWeight: 700 }}>Server</text>
  <text className="t" x="250" y="110" textAnchor="middle" style={{ fontSize: 11 }}>your C# runs</text>
  <path className="line" d="M120 85 H200" style={{ strokeDasharray: "4 4" }} />
  <path className="line" d="M120 105 H200" style={{ strokeDasharray: "4 4" }} />
  <circle r="6" style={{ fill: "#2563eb" }}><animate attributeName="cx" values="120;200" dur="1.4s" repeatCount="indefinite" /><animate attributeName="cy" values="85;85" dur="1.4s" repeatCount="indefinite" /></circle>
  <circle r="6" style={{ fill: "#16a34a" }}><animate attributeName="cx" values="200;120" dur="1.4s" begin="0.7s" repeatCount="indefinite" /><animate attributeName="cy" values="105;105" dur="1.4s" repeatCount="indefinite" /></circle>
  <text className="t" x="160" y="160" textAnchor="middle" style={{ fontSize: 12 }}>Each click goes to the server and back</text>
  <text className="t" x="160" y="180" textAnchor="middle" style={{ fontSize: 12 }}>over a live connection (SignalR).</text>
  <rect className="grn" x="520" y="40" width="100" height="50" rx="10" />
  <text className="t" x="570" y="70" textAnchor="middle" style={{ fontSize: 13, fontWeight: 700 }}>Server</text>
  <rect className="blu" x="350" y="90" width="130" height="80" rx="10" />
  <text className="t" x="415" y="118" textAnchor="middle" style={{ fontSize: 13, fontWeight: 700 }}>Browser</text>
  <text className="t" x="415" y="138" textAnchor="middle" style={{ fontSize: 11 }}>.NET + your C#</text>
  <rect x="375" y="146" width="80" height="14" rx="4" style={{ fill: "#6d28d9" }}>
    <animate attributeName="width" values="0;80;80" keyTimes="0;0.5;1" dur="3s" repeatCount="indefinite" />
  </rect>
  <path className="line" d="M520 70 Q470 70 450 90" />
  <circle r="6" style={{ fill: "#6d28d9" }}><animate attributeName="cx" values="520;450;450" keyTimes="0;0.5;1" dur="3s" repeatCount="indefinite" /><animate attributeName="cy" values="70;92;92" keyTimes="0;0.5;1" dur="3s" repeatCount="indefinite" /><animate attributeName="opacity" values="1;1;0" keyTimes="0;0.5;0.6" dur="3s" repeatCount="indefinite" /></circle>
  <text className="t" x="480" y="198" textAnchor="middle" style={{ fontSize: 12 }}>.NET downloads once (.wasm files).</text>
  <text className="t" x="480" y="216" textAnchor="middle" style={{ fontSize: 12 }}>After that, clicks stay in the browser.</text>
</svg>
<figcaption>Server mode keeps your code on the server. WebAssembly mode moves it into the browser.</figcaption>
</figure>

**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.

**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:

<figure className="blz-fig">
<svg viewBox="0 0 620 250" role="img" aria-labelledby="fig-blz-newapp">
  <title id="fig-blz-newapp">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.</title>
  <rect className="box" x="10" y="10" width="600" height="230" rx="12" />
  <rect x="10" y="10" width="600" height="30" rx="12" style={{ fill: "var(--panel2)" }} />
  <circle cx="30" cy="25" r="5" style={{ fill: "#f87171" }} />
  <circle cx="46" cy="25" r="5" style={{ fill: "#fbbf24" }} />
  <circle cx="62" cy="25" r="5" style={{ fill: "#34d399" }} />
  <rect x="90" y="16" width="300" height="18" rx="9" style={{ fill: "var(--panel)", stroke: "var(--line)" }} />
  <text className="t m" x="104" y="29" style={{ fontSize: 11 }}>https://localhost:7275</text>
  <rect x="10" y="40" width="150" height="200" style={{ fill: "#3a0647" }} />
  <text x="24" y="66" style={{ fill: "#fff", fontFamily: "var(--sans)", fontSize: 14, fontWeight: 700 }}>BlazorApp</text>
  <rect x="18" y="82" width="134" height="26" rx="5" style={{ fill: "rgba(255,255,255,0.25)" }}>
    <animate attributeName="y" values="82;82;114;114" keyTimes="0;0.45;0.5;1" dur="5s" repeatCount="indefinite" />
  </rect>
  <text x="30" y="100" style={{ fill: "#fff", fontFamily: "var(--sans)", fontSize: 13 }}>🏠 Home</text>
  <text x="30" y="132" style={{ fill: "#fff", fontFamily: "var(--sans)", fontSize: 13 }}>➕ Counter</text>
  <text x="30" y="164" style={{ fill: "#fff", fontFamily: "var(--sans)", fontSize: 13 }}>☁ Weather</text>
  <g>
    <animate attributeName="opacity" values="1;1;0;0" keyTimes="0;0.45;0.5;1" dur="5s" repeatCount="indefinite" />
    <text className="t" x="190" y="90" style={{ fontSize: 24, fontWeight: 700 }}>Hello, world!</text>
    <text className="t" x="190" y="120" style={{ fontSize: 13 }}>Welcome to your new app.</text>
  </g>
  <g opacity="0">
    <animate attributeName="opacity" values="0;0;1;1" keyTimes="0;0.45;0.5;1" dur="5s" repeatCount="indefinite" />
    <text className="t" x="190" y="90" style={{ fontSize: 24, fontWeight: 700 }}>Counter</text>
    <text className="t" x="190" y="120" style={{ fontSize: 13 }}>Current count: 0<animate attributeName="opacity" values="1;1;0;0" keyTimes="0;0.7;0.71;1" dur="5s" repeatCount="indefinite" /></text>
    <text className="t" x="190" y="120" style={{ fontSize: 13 }} opacity="0">Current count: 1<animate attributeName="opacity" values="0;0;1;1" keyTimes="0;0.7;0.71;1" dur="5s" repeatCount="indefinite" /></text>
    <rect x="190" y="136" width="84" height="28" rx="5" style={{ fill: "#1b6ec2" }} />
    <text x="232" y="155" textAnchor="middle" style={{ fill: "#fff", fontFamily: "var(--sans)", fontSize: 12 }}>Click me</text>
  </g>
  <path d="M0 0 L0 16 L4 12 L8 20 L11 18 L7 11 L12 11 Z" style={{ fill: "#111827", stroke: "#fff", strokeWidth: 1 }}>
    <animateTransform attributeName="transform" type="translate" values="300,200; 70,124; 70,124; 230,150; 230,150" keyTimes="0;0.4;0.5;0.68;1" dur="5s" repeatCount="indefinite" />
  </path>
</svg>
<figcaption>The new app: a menu on the left and the Home page. Click Counter, then Click me, and the number goes up.</figcaption>
</figure>

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.

<p>Cups ordered: @cups</p>

<button @onclick="OrderCup">Order a cup</button>

@code {
      private int cups = 0;

      private void OrderCup()
      {
          cups++;
      }
}
`,
  }}
/>

- `@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

<div className="tscroll">

| Mistake | Wrong idea | Correct idea | What goes wrong |
|---|---|---|---|
| Installing only the .NET Runtime | The Runtime is enough to build apps | Install the .NET 10 **SDK** | `dotnet new` and `dotnet run` are not found |
| Using an old terminal after installing | New programs work in open windows | Close and open the terminal again | "dotnet: command not found" |
| Starting a new app on .NET 8 or 9 | Any .NET version is fine | Use .NET 10 (LTS) | No more security fixes after November 2026 |
| Choosing the WebAssembly Standalone template by default | Both templates are the same | Start with **Blazor Web App** | You miss the server features you may need later |
| Writing the logic in JavaScript | Blazor still needs JavaScript for clicks | Handle events in C# with `@onclick` | Two languages for one small job |
| Forgetting `@` before a C# value | Blazor finds variables by itself | Write `@shopName` | The page shows the word `shopName` as text |

</div>

## 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**
