You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/ide/tutorial-csharp-aspnet-core.md
+54-39Lines changed: 54 additions & 39 deletions
Original file line number
Diff line number
Diff line change
@@ -16,60 +16,74 @@ ms.workload:
16
16
- "aspnet"
17
17
- "dotnetcore"
18
18
---
19
-
20
19
# Get started with C# and ASP.NET in Visual Studio
20
+
21
21
In this tutorial for C# development with ASP.NET Core using Visual Studio, you'll create a C# ASP.NET Core web app, add code to it, explore some features of the IDE, and run the app.
22
22
23
-
If you haven't already installed Visual Studio, go to the [Visual Studio downloads](https://aka.ms/vsdownload?utm_source=mscom&utm_campaign=msdocs) page to install it for free.
23
+
If you haven't already installed Visual Studio, go to the [Visual Studio downloads](https://www.visualstudio.com/downloads/?utm_medium=microsoft&utm_source=docs.microsoft.com&utm_campaign=button+cta&utm_content=download+vs2017) page to install it for free.
24
24
25
25
## Before you begin
26
+
26
27
Here's a quick FAQ to introduce you to some key concepts.
28
+
27
29
### What is C#?
30
+
28
31
[C#](/dotnet/csharp/getting-started/introduction-to-the-csharp-language-and-the-net-framework) is a type-safe and object-oriented programming language that's designed to be both robust and easy to learn.
32
+
29
33
### What is ASP.NET Core?
34
+
30
35
ASP.NET Core is an open-source and cross-platform framework for building internet-connected applications, such as web apps and services. ASP.NET Core apps can run on either .NET Core or the .NET Framework. You can develop and run your ASP.NET Core apps cross-platform on Windows, Mac, and Linux. ASP.NET Core is open source at [GitHub](https://github.com/aspnet/home).
36
+
31
37
### What is Visual Studio?
38
+
32
39
Visual Studio is an integrated development suite of productivity tools for developers. Think of it as a program you can use to create programs and applications.
33
40
34
41
## Start developing
42
+
35
43
Ready to start developing? Let's go!
36
44
37
45
### Create a project
46
+
38
47
First, you'll create a ASP.NET Core project. The project type comes with all the template files you'll need, before you've even added anything.
39
48
40
49
1. Open Visual Studio 2017.
41
50
42
51
2. From the top menu bar, choose **File** > **New** > **Project**.
43
52
44
-
3. In the **New Project** dialog box in the left pane, expand **Visual C#**, expand **Web**, and then choose **.NET Core**. In the middle pane, choose **ASP.NET Core Web Application**, name the file *MyCoreApp*, and then choose **OK**.
53
+
3. In the **New Project** dialog box in the left pane, expand **Visual C#**, expand **Web**, and then choose **.NET Core**. In the middle pane, choose **ASP.NET Core Web Application**, name the file *MyCoreApp*, and then choose **OK**.
45
54
46
55

47
56
48
57
#### Add a workload (optional)
58
+
49
59
If you don't see the **ASP.NET Core Web Application** project template, you can get it by adding the **ASP.NET and web development** workload. You can add this workload in one of the two following ways, depending on which Visual Studio 2017 updates are installed on your machine.
50
60
51
61
##### Option 1: Use the New Project dialog box
62
+
52
63
1. Click the **Open Visual Studio Installer** link in the left pane of the **New Project** dialog box.
53
64
54
-

65
+

55
66
56
67
2. The Visual Studio Installer launches. Choose the **ASP.NET and web development** workload, and then choose **Modify**.
57
68
58
69

59
70
60
71
##### Option 2: Use the Tools menu bar
72
+
61
73
1. Cancel out of the **New Project** dialog box and from the top menu bar, choose **Tools** > **Get Tools and Features**.
62
74
63
-
2. The Visual Studio Installer launches. Choose the **ASP.NET and web development** workload, and then choose **Modify**.
75
+
2. The Visual Studio Installer launches. Choose the **ASP.NET and web development** workload, and then choose **Modify**.
64
76
65
77
#### Add a project template
78
+
66
79
1. In the **New ASP.NET Core Web Application** dialog box, choose the **Web Application (Model-View-Controller)** project template.
67
80
68
81
2. Select **ASP.NET Core 2.0** from the top drop-down menu. (If you don't see **ASP.NET Core 2.0** in the list, install it by following the **Download** link that should appear in a yellow bar near the top of the dialog box.) Choose **OK**.
69
82
70
83

71
84
72
85
### About your solution
86
+
73
87
This solution follows the Model-View-Controller (MVC) architectural pattern that separates an app into three main components:
74
88
75
89
***Models** include classes that represent the data of the app. The model classes use validation logic to enforce business rules for that data. Typically, model objects retrieve and store model state in a database.
@@ -79,87 +93,88 @@ This solution follows the Model-View-Controller (MVC) architectural pattern that
79
93
The MVC pattern helps you create apps that are easier to test and update than traditional monolithic apps.
80
94
81
95
### Tour your solution
82
-
1. The project template creates a solution with a single ASP.NET Core project that is named **MyCoreApp**. Expand the project node to expose its contents.
96
+
97
+
1. The project template creates a solution with a single ASP.NET Core project that is named **MyCoreApp**. Expand the project node to expose its contents.
83
98
84
99

85
100
86
-
1. Open the *HomeController.cs* file from the **Controllers** folder.
101
+
2. Open the *HomeController.cs* file from the **Controllers** folder.
87
102
88
-

103
+

89
104
90
-
2. View the *HomeController.cs*
105
+
3. View the *HomeController.cs*
91
106
92
-

107
+

93
108
94
-
4. The project also has a **Views** folder that contains other folders that map to each controller (as well as one for **Shared** views). For example, the view CSHTML file (an extension of HTML) for the */Home/About* path would be at *Views/Home/About.cshtml*. Open that file.
109
+
4. The project also has a **Views** folder that contains other folders that map to each controller (as well as one for **Shared** views). For example, the view CSHTML file (an extension of HTML) for the */Home/About* path would be at *Views/Home/About.cshtml*. Open that file.
95
110
96
-

111
+

97
112
98
-
5. This CSHTML file uses the Razor syntax to render HTML based on a combination of standard tags and inline C#.
113
+
5. This CSHTML file uses the Razor syntax to render HTML based on a combination of standard tags and inline C#.
99
114
100
-

115
+

101
116
102
-
>[!NOTE]
103
-
> To learn more about this, see the [Get started with C# and ASP.NET using the Razor syntax](/aspnet/web-pages/overview/getting-started/introducing-razor-syntax-c) page.
117
+
>[!NOTE]
118
+
> To learn more about this, see the [Get started with C# and ASP.NET using the Razor syntax](/aspnet/web-pages/overview/getting-started/introducing-razor-syntax-c) page.
104
119
105
-
6. The solution also contains a *wwwroot* folder that is the root for your web site. You can put static site content, such as CSS, images, and JavaScript libraries, directly at the paths you'd want them to be at when the site is deployed.
120
+
6. The solution also contains a *wwwroot* folder that is the root for your web site. You can put static site content, such as CSS, images, and JavaScript libraries, directly at the paths you'd want them to be at when the site is deployed.
106
121
107
-

122
+

108
123
109
-
7. There are also a variety of configuration files that serve to manage the project, its packages, and the application at runtime. For example, the default application [configuration](/aspnet/core/fundamentals/configuration) is stored in *appsettings.json*. However, you can override some/all of these settings on a per-environment basis, such as by providing an *appsettings.Development.json* file for the **Development** environment.
124
+
7. There are also a variety of configuration files that serve to manage the project, its packages, and the application at runtime. For example, the default application [configuration](/aspnet/core/fundamentals/configuration) is stored in *appsettings.json*. However, you can override some/all of these settings on a per-environment basis, such as by providing an *appsettings.Development.json* file for the **Development** environment.
110
125
111
-

126
+

112
127
113
128
## Run and debug the application
114
129
115
130
1. Choose the **IIS Express** button in the IDE to build and run the app in Debug mode. (Alternatively, press **F5**, or choose **Debug > Start Debugging** from the menu bar.)
116
131
117
-

132
+

118
133
119
134
> [!NOTE]
120
135
> If you get an error message that says **Unable to connect to web server 'IIS Express'**, close Visual Studio and then open it by using the **Run as administrator** option from the right-click or context menu. Then, run the application again.
121
136
122
-
1. Visual Studio launches a browser window. Select **About**.
137
+
2. Visual Studio launches a browser window. Select **About**.
123
138
124
-

139
+

125
140
126
141
Among other things, the **About** page in the browser renders the text that is set in the *HomeController.cs* file.
127
142
128
143

129
144
130
-
1. Keep the browser window open and return to Visual Studio. Open *Controllers/HomeController.cs* if it's not already open.
145
+
3. Keep the browser window open and return to Visual Studio. Open *Controllers/HomeController.cs* if it's not already open.
131
146
132
-

147
+

133
148
134
-
1. Set a breakpoint in the first line of the **About** method. To do this, click in the margin or set the cursor on the line and press **F9**.
149
+
4. Set a breakpoint in the first line of the **About** method. To do this, click in the margin or set the cursor on the line and press **F9**.
135
150
136
151
This line sets some data in the **ViewData** collection that is rendered in the CSHTML page at *Views/Home/About.cshtml*.
137
152
138
-

153
+

139
154
140
-
1. Return to the browser and refresh the **About** page. This will trigger the breakpoint in Visual Studio.
155
+
5. Return to the browser and refresh the **About** page. This will trigger the breakpoint in Visual Studio.
141
156
142
-
1. In Visual Studio, mouse over the **ViewData** member to view its data.
157
+
6. In Visual Studio, mouse over the **ViewData** member to view its data.
143
158
144
-

159
+

145
160
146
-
1. Remove the application breakpoint using the same method you used to add it.
161
+
7. Remove the application breakpoint using the same method you used to add it.
147
162
148
-
1. Open *Views/Home/About.cshtml*.
163
+
8. Open *Views/Home/About.cshtml*.
149
164
150
-

165
+

151
166
152
-
1. Change the text **"additional"** to **"changed"** and save the file.
167
+
9. Change the text **"additional"** to **"changed"** and save the file.
153
168
154
-

169
+

155
170
156
-
1. Return to the browser window to see the updated text. (Refresh the browser if you don't see the text that you changed.)
171
+
10. Return to the browser window to see the updated text. (Refresh the browser if you don't see the text that you changed.)
157
172
158
-

173
+

159
174
160
-
1. Choose the **Stop Debugging** button from the toolbar to stop debugging. (Alternatively, press **Shift**+**F5**, or choose **Debug** > **Stop Debugging** from the menu bar.)
175
+
11. Choose the **Stop Debugging** button from the toolbar to stop debugging. (Alternatively, press **Shift**+**F5**, or choose **Debug** > **Stop Debugging** from the menu bar.)
161
176
162
-

177
+

Copy file name to clipboardExpand all lines: docs/ide/tutorial-visual-basic-console.md
+6-3Lines changed: 6 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -15,12 +15,11 @@ dev_langs:
15
15
ms.workload:
16
16
- "multiple"
17
17
---
18
-
19
18
# Get started with Visual Basic in Visual Studio
20
19
21
20
In this tutorial for Visual Basic (VB), you'll use Visual Studio to create and run a few different console apps, and explore some features of the [Visual Studio integrated development environment (IDE)](visual-studio-ide.md) while you do so.
22
21
23
-
If you haven't already installed Visual Studio, go to the [Visual Studio downloads](https://aka.ms/vsdownload?utm_source=mscom&utm_campaign=msdocs) page to install it for free.
22
+
If you haven't already installed Visual Studio, go to the [Visual Studio downloads](https://www.visualstudio.com/downloads/?utm_medium=microsoft&utm_source=docs.microsoft.com&utm_campaign=button+cta&utm_content=download+vs2017) page to install it for free.
24
23
25
24
## Before you begin
26
25
@@ -59,9 +58,11 @@ First, we'll create a Visual Basic application project. The project type comes w
59
58

60
59
61
60
#### Add a workgroup (optional)
61
+
62
62
If you don't see the **Console App (.NET Core)** project template, you can get it by adding the **.NET Core cross-platform development** workload. You can add this workload in one of the two following ways, depending on which Visual Studio 2017 updates are installed on your machine.
63
63
64
64
##### Option 1: Use the New Project dialog box
65
+
65
66
1. Click the **Open Visual Studio Installer** link in the left pane of the **New Project** dialog box.
66
67
67
68

@@ -71,9 +72,10 @@ If you don't see the **Console App (.NET Core)** project template, you can get i
71
72

72
73
73
74
##### Option 2: Use the Tools menu bar
75
+
74
76
1. Cancel out of the **New Project** dialog box and from the top menu bar, choose **Tools** > **Get Tools and Features**.
75
77
76
-
2. The Visual Studio Installer launches. Choose the **.NET Core cross-platform development** workload, and then choose **Modify**.
78
+
2. The Visual Studio Installer launches. Choose the **.NET Core cross-platform development** workload, and then choose **Modify**.
77
79
78
80
## Create a "What Is Your Name" application
79
81
@@ -103,6 +105,7 @@ Let's create an app that prompts you for your name and then displays it along wi
0 commit comments