Skip to content

Commit c018725

Browse files
committed
Address all release branch review suggestions
1 parent 49558ea commit c018725

12 files changed

+47
-72
lines changed

learn-pr/aspnetcore/build-your-first-aspnet-core-web-app/code/MyWebApp/MyWebApp.csproj

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

learn-pr/aspnetcore/build-your-first-aspnet-core-web-app/code/MyWebApp/Program.cs

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

learn-pr/aspnetcore/build-your-first-aspnet-core-web-app/code/MyWebApp/Properties/launchSettings.json

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

learn-pr/aspnetcore/build-your-first-aspnet-core-web-app/code/MyWebApp/appsettings.Development.json

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

learn-pr/aspnetcore/build-your-first-aspnet-core-web-app/code/MyWebApp/appsettings.json

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

learn-pr/aspnetcore/build-your-first-aspnet-core-web-app/includes/3-exercise-create-project.md

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ In Visual Studio Code, create a new project:
1111

1212
1. Select the **Explorer** view:
1313

14-
:::image type="content" source="../media/vsc-select-explorer.png" alt-text="Selecting the Explorer view":::
14+
:::image type="content" source="../media/vs-code-select-explorer.png" alt-text="Screenshot of selecting the Explorer view":::
1515

1616
1. Select the **Create .NET Project** button. Alternatively, you can bring up the **Command Palette** using <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd>, and then type "`.NET`" to find and select the **.NET: New Project** command.
1717

18-
:::image type="content" source="../media/vsc-select-create-dotnet-project.png" alt-text="Selecting Create .NET Project":::
18+
:::image type="content" source="../media/vs-code-select-create-dotnet-project.png" alt-text="Screenshot of selecting Create .NET Project":::
1919

2020
1. Select the **ASP.NET Core Empty** project template from the list.
2121
1. In the **Project Location** dialog, create a folder named `MyWebApp` to contain the project.
@@ -26,7 +26,7 @@ In Visual Studio Code, create a new project:
2626

2727
The *MyWebApp* project folder contents are displayed in the Visual Studio Code **Explorer**:
2828

29-
:::image type="content" source="../media/vsc-explorer-project-files.png" alt-text="The project files in the Visual Studio Code Explorer":::
29+
:::image type="content" source="../media/vs-code-explorer-project-files.png" alt-text="Screenshot of the project files in the Visual Studio Code Explorer":::
3030

3131
::: zone-end
3232

@@ -62,7 +62,7 @@ From a terminal or the command line, create a new project:
6262
6363
The *MyWebApp* project folder contents are displayed in the Visual Studio Code **Explorer**:
6464
65-
:::image type="content" source="../media/vsc-explorer-project-files.png" alt-text="The project files in the Visual Studio Code Explorer":::
65+
:::image type="content" source="../media/vs-code-explorer-project-files.png" alt-text="Screenshot of the project files in the Visual Studio Code Explorer":::
6666
6767
::: zone-end
6868
@@ -97,7 +97,31 @@ The *Properties/launchSettings.json* file contains configuration data for how th
9797
9898
The *launchSettings.json* file contains the following configuration:
9999
100-
[!code-json[](../code/mywebapp/properties/launchSettings.json)]
100+
```json
101+
{
102+
"$schema": "https://json.schemastore.org/launchsettings.json",
103+
"profiles": {
104+
"http": {
105+
"commandName": "Project",
106+
"dotnetRunMessages": true,
107+
"launchBrowser": true,
108+
"applicationUrl": "http://localhost:5218",
109+
"environmentVariables": {
110+
"ASPNETCORE_ENVIRONMENT": "Development"
111+
}
112+
},
113+
"https": {
114+
"commandName": "Project",
115+
"dotnetRunMessages": true,
116+
"launchBrowser": true,
117+
"applicationUrl": "https://localhost:7140;http://localhost:5218",
118+
"environmentVariables": {
119+
"ASPNETCORE_ENVIRONMENT": "Development"
120+
}
121+
}
122+
}
123+
}
124+
```
101125

102126
### The *Program.cs* file
103127

@@ -110,15 +134,27 @@ The *Program.cs* file serves as the entry point for an ASP.NET Core app and has
110134

111135
In the new empty ASP.NET Core project you created, the *Program.cs* file contains the following minimal code:
112136

113-
[!code-csharp[](../code/mywebapp/program.cs?name=snippet_all)]
137+
```csharp
138+
var builder = WebApplication.CreateBuilder(args);
139+
var app = builder.Build();
140+
141+
app.MapGet("/", () => "Hello World!");
142+
143+
app.Run();
144+
```
114145

115146
The following lines of code in this file create a `WebApplicationBuilder` with preconfigured defaults, and builds the app:
116147

117-
[!code-csharp[](../code/mywebapp/program.cs?name=snippet_web_application_builder)]
148+
```csharp
149+
var builder = WebApplication.CreateBuilder(args);
150+
var app = builder.Build();
151+
```
118152

119153
The `app.MapGet()` method directly defines an endpoint that handles HTTP GET requests:
120154

121-
[!code-csharp[](../code/mywebapp/program.cs?name=snippet_web_mapget)]
155+
```csharp
156+
app.MapGet("/", () => "Hello World!");
157+
```
122158

123159
`app.MapGet("/")`: Defines a route for the HTTP GET request. The `/` indicates this route responds to the requests made to the root URL of the app. For example, `http://localhost:{port}/`, where `{port}` is a randomly assigned port number assigned in the *Properties/launchSettings.json* file at project creation.
124160

learn-pr/aspnetcore/build-your-first-aspnet-core-web-app/includes/4-exercise-run-project.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ Run the web app in Visual Studio Code and view in a browser:
2121

2222
1. At the **Select debugger** prompt in the **Command Palette** at the top of the Visual Studio Code UI, select **C#**. At the next prompt, select the default launch configuration (`C#: MyWebApp [Default Configuration]`):
2323

24-
:::image type="content" source="../media/vsc-select-bebugger.png" alt-text="Chosing Select debugger in the Command Pallette":::
24+
:::image type="content" source="../media/vs-code-select-debugger.png" alt-text="Screenshot of choosing Select debugger in the Command Pallette":::
2525

2626
The default browser is launched at `http://localhost:{PORT}`, which displays the app's response. The `{PORT}` placeholder is the random port assigned to the app when the app's project is created. If you need to change the port due to a local port conflict, change the port in the project's *Properties/launchSettings.json* file.
2727

2828
The response displayed in the browser:
2929

30-
:::image type="content" source="../media/browser-displays-helloworld.png" alt-text="A browser displaying the text output":::
30+
:::image type="content" source="../media/browser-displays-hello-world.png" alt-text="Screenshot of a browser displaying the text output":::
3131

3232
1. Close the browser window.
3333

@@ -65,7 +65,7 @@ Run the web app using the .NET CLI:
6565
6666
1. Open a browser to the URL generated at your own command line output, the app's response `Hello World!` is displayed:
6767
68-
:::image type="content" source="../media/browser-displays-helloworld.png" alt-text="A browser displaying the text output":::
68+
:::image type="content" source="../media/browser-displays-hello-world.png" alt-text="Screenshot of a browser displaying the text output":::
6969
7070
1. Press Ctrl+C at the command line to shut down the app.
7171

0 commit comments

Comments
 (0)