filmov
tv
#1 Your First ASP NET Core MVC Application - ASP.NET Core MVC 2

Показать описание
Your First ASP.NET Core MVC Application
Installing Visual Studio
This tutorial relies on Visual Studio 2017, which provides the development environment for ASP.NET Core
MVC projects.
I use the free Visual Studio 2019 Community edition, which can be downloaded from
When installing Visual Studio 2019, you must select the .NET Core cross-platform
development workload.
Visual Studio 2019 predates the release of ASP.NET Core MVC 2.2. You must apply the latest updates if
you have installed Visual Studio for earlier versions of ASP.NET Core MVC. You can apply updates by running the
Visual Studio installer and selecting update for the Visual Studio edition you are using.
Selecting the Visual Studio workload
Visual Studio only supports Windows. You can create ASP.NET Core MVC applications on other platforms using Visual Studio Code.
Visual Studio Code doesn’t provide all of the features of Visual Studio, but it is an excellent editor and does everything required for MVC application development.
I'll talk about Visual Studio Code later.
Installing the .NET Core 2.0 SDK
The Visual Studio installation includes all of the features required for ASP.NET Core MVC development, but
it doesn’t include .NET Core 2.0, which must be downloaded and installed separately.
Windows. Once the installer has finished, open a new command prompt or PowerShell window and run the
following command to display the version of .NET that has been installed:
dotnet --version
If the installation has been successful, the result of this command will be 2.0.0
Creating a New ASP.NET Core MVC Project
I am going to start by creating a new ASP.NET Core MVC project in Visual Studio.
The choice of project template can be confusing because their names are so similar. The ASP.NET
Web Application (.NET Framework) template is for creating projects using the legacy versions of ASP.NET and
the MVC Framework, which predated ASP.NET Core.
The other two templates are for creating ASP.NET Core applications, and they differ in the runtime they use,
allowing you to select either the .NET Framework or .NET Core.
I explain the difference between them later, but I use the .NET Core option, so it is the one you should select to ensure that you get the same results from the example applications
Installing Visual Studio
This tutorial relies on Visual Studio 2017, which provides the development environment for ASP.NET Core
MVC projects.
I use the free Visual Studio 2019 Community edition, which can be downloaded from
When installing Visual Studio 2019, you must select the .NET Core cross-platform
development workload.
Visual Studio 2019 predates the release of ASP.NET Core MVC 2.2. You must apply the latest updates if
you have installed Visual Studio for earlier versions of ASP.NET Core MVC. You can apply updates by running the
Visual Studio installer and selecting update for the Visual Studio edition you are using.
Selecting the Visual Studio workload
Visual Studio only supports Windows. You can create ASP.NET Core MVC applications on other platforms using Visual Studio Code.
Visual Studio Code doesn’t provide all of the features of Visual Studio, but it is an excellent editor and does everything required for MVC application development.
I'll talk about Visual Studio Code later.
Installing the .NET Core 2.0 SDK
The Visual Studio installation includes all of the features required for ASP.NET Core MVC development, but
it doesn’t include .NET Core 2.0, which must be downloaded and installed separately.
Windows. Once the installer has finished, open a new command prompt or PowerShell window and run the
following command to display the version of .NET that has been installed:
dotnet --version
If the installation has been successful, the result of this command will be 2.0.0
Creating a New ASP.NET Core MVC Project
I am going to start by creating a new ASP.NET Core MVC project in Visual Studio.
The choice of project template can be confusing because their names are so similar. The ASP.NET
Web Application (.NET Framework) template is for creating projects using the legacy versions of ASP.NET and
the MVC Framework, which predated ASP.NET Core.
The other two templates are for creating ASP.NET Core applications, and they differ in the runtime they use,
allowing you to select either the .NET Framework or .NET Core.
I explain the difference between them later, but I use the .NET Core option, so it is the one you should select to ensure that you get the same results from the example applications