Skip to content

Commit c711a8d

Browse files
committed
Get started tutorial updates
1 parent d75eedc commit c711a8d

31 files changed

+186
-145
lines changed

.openpublishing.redirection.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,6 +1567,11 @@
15671567
"source_path": "aspnetcore/blazor/progressive-web-app.md",
15681568
"redirect_url": "/aspnet/core/blazor/progressive-web-app/",
15691569
"redirect_document_id": false
1570+
},
1571+
{
1572+
"source_path": "aspnetcore/blazor/getting-started/index.md",
1573+
"redirect_url": "/aspnet/core/blazor/get-started",
1574+
"redirect_document_id": false
15701575
}
15711576
]
15721577
}

aspnetcore/data/ef-rp/intro.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ ms.custom: "mvc"
88
ms.date: 04/23/2025
99
uid: data/ef-rp/intro
1010
---
11-
1211
# Razor Pages with Entity Framework Core in ASP.NET Core - Tutorial 1 of 8
1312

1413
[!INCLUDE[](~/includes/not-latest-version.md)]

aspnetcore/fundamentals/servers/yarp/direct-forwarding.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ See [ReverseProxy.Direct.Sample](https://github.com/microsoft/reverse-proxy/tree
3939

4040
### Create a new project
4141

42-
Follow the [Getting Started](xref:getting-started) guide to create a project and add the Yarp.ReverseProxy nuget dependency.
42+
Create a Razor Pages project from the project template and add the [`Yarp.ReverseProxy` NuGet package](https://www.nuget.org/packages/Yarp.ReverseProxy).
4343

44-
### Update Program.cs
44+
### Update `Program.cs`
4545

4646
In this example the IHttpForwarder is registered in DI, injected into the endpoint method, and used to forward requests from a specific route to `https://localhost:10000/prefix/`.
4747

aspnetcore/get-started.md

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
---
2+
title: Get started with ASP.NET Core
3+
author: tdykstra
4+
description: A short tutorial using the .NET CLI to create and run a basic Hello World app using ASP.NET Core Blazor.
5+
monikerRange: ">= aspnetcore-3.1"
6+
ms.author: tdykstra
7+
ms.custom: mvc
8+
ms.date: 07/21/2025
9+
uid: get-started
10+
---
11+
# Get started with ASP.NET Core
12+
13+
[!INCLUDE[](~/includes/not-latest-version.md)]
14+
15+
This tutorial shows how to create, run, and modify an ASP.NET Core Blazor Web App using the .NET CLI.
16+
17+
You'll learn how to:
18+
19+
> [!div class="checklist"]
20+
> * Create a Blazor Web App.
21+
> * Run the app.
22+
> * Change the app.
23+
> * Shut the app down.
24+
25+
At the end, you'll have a working web app running on your local machine.
26+
27+
## Prerequisites
28+
29+
Obtain and install the latest .NET SDK at [Download .NET](https://dotnet.microsoft.com/download/dotnet).
30+
31+
## Create a web app project
32+
33+
Open a command shell to a suitable location for the sample app and enter the following command to create a Blazor Web App. The `-o|--output` option creates a folder for the project and names the project `BlazorSample`:
34+
35+
```dotnetcli
36+
dotnet new blazor -o BlazorSample
37+
```
38+
39+
## Run the app
40+
41+
Change the directory to the `BlazorSample` folder with the following command:
42+
43+
```dotnetcli
44+
cd BlazorSample
45+
```
46+
47+
Execute the following command to run the app:
48+
49+
```dotnetcli
50+
dotnet watch
51+
```
52+
53+
The `dotnet watch` command runs the app and opens your default browser to the app's landing page.
54+
55+
The browser shows the app's home page.
56+
57+
Using the app's sidebar navigation, visit the Counter page, where you can select the **:::no-loc text="Click me":::** button to increment the counter. Visit the Weather page to see a page load weather data.
58+
59+
## Edit a Razor component
60+
61+
Leave the browser open with the app loaded. By using the `dotnet watch` command to run the app, you can make changes to the app's markup and code and see the changes immediately reflected in the browser.
62+
63+
The `Counter` Razor component that renders the Counter web page is located at `Components/Pages/Counter.razor` in the project.
64+
65+
Open the `Counter.razor` file in a text editor and note a few interesting lines that render content and make the component's counter feature work:
66+
67+
The component starts with a line that indicates the component's relative path (`/counter`):
68+
69+
```razor
70+
@page "/counter"
71+
```
72+
73+
The title of the page is set by `<PageTitle>` tags:
74+
75+
```razor
76+
<PageTitle>Counter</PageTitle>
77+
```
78+
79+
An H1 heading is displayed:
80+
81+
```razor
82+
<h1>Counter</h1>
83+
```
84+
85+
A paragraph element (`<p>`) displays the current count, which is stored in a variable named `currentCount`:
86+
87+
```razor
88+
<p role="status">Current count: @currentCount</p>
89+
```
90+
91+
A button (`<button>`) allows the user to call a C# method named `IncrementCount` when the button is selected:
92+
93+
```razor
94+
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
95+
```
96+
97+
C# code is present in the `@code` block:
98+
99+
```razor
100+
@code {
101+
...
102+
}
103+
```
104+
105+
Within the `@code` block:
106+
107+
* The counter variable `currentCount` is established with an initial value of zero.
108+
* The `IncrementCount` method is defined. The code within the method increments the `currentCount` variable by one each time the method is invoked.
109+
110+
```csharp
111+
private int currentCount = 0;
112+
113+
private void IncrementCount()
114+
{
115+
currentCount++;
116+
}
117+
```
118+
119+
Let's change the increment of the counter in the `IncrementCount` method.
120+
121+
Change the line so that `currentCount` is incremented by a value of ten each time `IncrementCount` is called:
122+
123+
```diff
124+
- currentCount++;
125+
+ currentCount += 10;
126+
```
127+
128+
Save the file.
129+
130+
As soon as you save the file, the running app is updated automatically because you used the `dotnet watch` command to run the app. Go back to the app in the browser with the Counter page loaded and select the **:::no-loc text="Click me":::** button. Witness how the counter now increments by ten.
131+
132+
To shut down the app:
133+
134+
* Close the browser window.
135+
* Press <kbd>Ctrl</kbd>+<kbd>C</kbd> in the command shell.
136+
137+
*Congratulations!* You've successfully completed this tutorial.
138+
139+
## Next steps
140+
141+
In this tutorial, you learned how to:
142+
143+
> [!div class="checklist"]
144+
> * Create a Blazor Web App.
145+
> * Run the app.
146+
> * Change the app.
147+
> * Shut the app down.
148+
149+
To learn more about ASP.NET Core, see the following:
150+
151+
> [!div class="nextstepaction"]
152+
> <xref:index#recommended-learning-path>
153+
154+
## Additional resources
155+
156+
[Additional Blazor tutorials](xref:blazor/tutorials/index)
-30.7 KB
Binary file not shown.
-24.7 KB
Binary file not shown.

aspnetcore/getting-started/index.md

Lines changed: 0 additions & 109 deletions
This file was deleted.

aspnetcore/getting-started/sample/Index.cshtml

Lines changed: 0 additions & 10 deletions
This file was deleted.
File renamed without changes.

0 commit comments

Comments
 (0)