Create an ASP. NET Core using Vscode

Source: Internet
Author: User
Tags dotnet

Objective

The. Net Core 2.0 has been released for months, ashamed! As a developer is now beginning to contact, some people say there is the universe of the first IDE, why use Vscode, why? Because we are the program ape Ah! We are the Siege Lions! We love to toss Ah, in the non-Windows experience the kind of excitement of compiling net, just like the first HelloWorld when programming the output of the computer screen that feeling, cool! Look at my big net can also run under Linux.
This article is a reference to the Zhang Shanyu Teacher's blog and Microsoft Official tutorial completed under the beginning (please forgive the poor force I can only practice under the window), if there is unreasonable place to welcome correct, will learn humbly.

Development environment
    • Operating system: WIN10
    • . Net Core Version: 2.0.2 (Download the latest on the website)
    • Code Editor: Visual Studio Code
    • NET Core and Visual Studio Code download links
Operation Steps

1. Create a "HelloWorld" folder

2. Open Visual Studio Code and open the "HelloWorld" folder you just created

3. We all know. Netcore is executed with the command line (see the reference 1 link for an unknown) to open the integrated terminal

4. In the command terminal, enter "dotnet new Sln-n HelloWorld", press ENTER to execute, at this time in our "HelloWorld" folder will generate "HelloWorld.sln" file

5. Create "Helloworld.web" project, enter "dotnet new Mvc-n Helloworld.web" in the integration terminal, press ENTER, at this time we have generated an MVC project folder under the folder

6. Press F5, select. NET Core, for example, will automatically generate a profile "Launch.json" (the file used in the configuration file JSON format , not the config file We are familiar with)

7. Start build, execute "dotnet build Helloworld.web" in terminal, press ENTER, similar to we use VS to compile the program, the Bin/debug folder will be added under the project folder now.

8. Modify the configuration file "Launch.json" file, we are the Web project, so we want to modify the Name= ". NET Core Launch (web)" section in the "Configuration" node,
The program value is modified to the path of the file we have created, namely: ${workspacefolder}/helloworld.web/bin/debug/netcoreapp2.0/helloworld.web.dll
CWD is modified to our specific project file path, i.e.: ${workspacefolder}/helloworld.web

9. Select the Debug Info button, the bug picture, and press F5, and the "Prelaunchtask" build appears. ", this issue should be caused by the lack of the corresponding build information,
Select the configuration task, select. NET Core, and add a default Tasks.json profile.

10. After adding Task.json, press F5 to run happily.

Summarize

1. Two problems encountered one is the path formulation of program in the Launch.json file, which needs to be ${workspacefolder} After configuring the path of the whole Helloworld.web project, modifying only the path behind the bin will result in a missing helloworld.web level path when executing, and the other is the need to manually add Task.json files. See this post that can be blocked off Prelaunchtask this configuration resolved.
2. Look at what others write or need to try it in person, or how to find out the actual operation of the problem in the process.

Resources
    1. Get started with. NET in minutes-Microsoft Official tutorial
    2. The Lab Handbook uses visual Studio Code to develop. NET core applications-Zhang Shanyu

Create an ASP. NET Core using Vscode

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.