Use VS Code to Develop ASP. NET Core applications
Use VS Code to Develop ASP. NET Core applications
Preparation
1. Install VS Code https://code.visualstudio.com/
2. Install Node. js https://nodejs.org/
Install ASP. NET Core and DNX
First install DNVM
CMD
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "&{$Branch='dev';$wc=New-Object System.Net.WebClient;$wc.Proxy=[System.Net.WebRequest]::DefaultWebProxy;$wc.Proxy.Credentials=[System.Net.CredentialCache]::DefaultNetworkCredentials;Invoke-Expression ($wc.DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}"
Powershell
&{$Branch='dev';$wc=New-Object System.Net.WebClient;$wc.Proxy=[System.Net.WebRequest]::DefaultWebProxy;$wc.Proxy.Credentials=[System.Net.CredentialCache]::DefaultNetworkCredentials;Invoke-Expression ($wc.DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}
Select either of them.
After the installation, you can use the dnvm command.
Input in cmd
where dnvm
The dnvm installation path is displayed.
Install and generate an ASP. NET Core application tool
Input in cmd
npm install -g yo generator-aspnet gulp bower
If there is no npm, install the npm environment first.
After installing yo, we can use yo to generate an ASP. NET Core application.
Input in cmd
yo aspnet
Select Web Application and enter the name. The program will be generated soon.
Use VS Code to open a folder.
Run the VS Code command line in F1 and enter dnx: Restore Packages and press Enter.
After restoration, Run F1 to open the VS Code Command line and enter dnx: Run Command and press Enter.
Select dnx web. The following interface is displayed and runs successfully.
Enter http: // localhost: 5000/in the address bar of the browser/
VS Code cannot debug ASP. NET Core for the moment. We hope the official version can be used for debugging and development.
There is no problem with VS Code writing, and smart prompts are all complete.
Reference:
Https://code.visualstudio.com/docs/runtimes/ASPnet5
This article permanently updates the link address: