Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use VS Code to develop ASP.NET 5 applications

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

Today, I will talk to you about how to use VS Code to develop ASP.NET 5 applications. Many people may not know much about it. In order to make you understand better, the editor has summarized the following for you. I hope you can get something according to this article.

Preparatory work

1. Install VS Code https://code.visualstudio.com/

two。 Install NODEJS https://nodejs.org/en/

Install DNVM

DNVM, whose full name is .NET Version Manager, is a basic tool for supporting the next generation of ASP.NET and already supports cross-platform (Windows,Linux,Mac).

Https://github.com/aspnet/home#upgrading-dnvm-or-running-without-visual-studio

Run cmd under Windows, and then execute the following command

@ powershell-NoProfile-ExecutionPolicy unrestricted-Command "& {$Branch='dev';iex ((new-object net.webclient) .DownloadString) ('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}" to verify whether the installation is successful, you can try to execute dnvm. If you see the following output, your installation is successful.

Next install the necessary runtime (runtime). Dnvm is used to manage different runtimes. Currently, two different types of runtime are supported, one is the traditional .NET CLR, and the other is the simplified version of CLR. At present, Microsoft defines the name as CoreClr.

This coreclr is completely open source, please refer to https://github.com/dotnet/coreclr

You can install the latest version of the runtime using the following command (dynamic download is required, which may take some time)

Dnvm install latest-arch x64-r clr installs the latest version of the 64-bit clr runtime (currently 4.5.1)

Dnvm install latest-arch x64-r coreclr installs the latest version of the 64-bit coreclr runtime

Install the necessary tools to generate the ASP.NET 5 application npm install-g yo grunt-cli generator-aspnet bower

This command uses the npm package manager to install a series of nodejs modules. If you don't know much about them, please ignore them directly. We'll study it later.

Next, you can use yo as a tool to generate ASP.NET 5 applications.

Input: yo aspnet

Select "Web Application Basic (Without Membership and authorization)", enter, and give him a name, such as aspnet5web.

An application is quickly generated (in fact, it should be a template generation process)

Then, we will execute the following command in turn

Cd aspnet5web

Dnu restore (this command is used to load dependent packages for the project, from the nuget website)

Run this project

You can enable this project by running dnx web in cmd

By default, the site listens on port 5000, so open http://localhost:5000 in a browser to see the following effect

Open a project using VS Code

On the command line, enter code.

This is an ASP.NET MVC project that we are familiar with and unfamiliar with. We are familiar with it because we are quite familiar with its basic project structure. Strange to say, in fact, this project is fundamentally different from the previous MVC project, it is completely based on OWIN, and has a lot of special scripting features. It is said that the view grammar is also different. Let's study it again sometime.

After reading the above, do you have any further understanding of how to use VS Code to develop ASP.NET 5 applications? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report