Okay, now let's assume you've installed the VS code developer,. Net Core 2.0 Preview SDK dotnet-sdk-2.0.0 (note your operating system), and have installed C # extensions for VS code (in VS Code in the Extended menu, enter Omnisharp, install the extension)
First, we will create a new folder under some magical directory of our computer hard drive. I chose this place under D:\WorkTest and created a folder named Mycms. Note that this step is not done in VS code, and it looks like you can't create a folder in VS code.
Second, in the VS Code development environment, select File-open folder, and then select the Magical folder we just created Mycms open
Third, select View--Integrated terminal command or press the shortcut key Ctrl + ', a powerful tool will appear in the VS Code development environment. Why do you say it's bad? As we enter some magical commands here, some magical phenomena will occur in our project. For example, I'll enter the command in the integration Terminal dotnet new sln-n mycms, a solution MyCMS.sln appears under our Mycms folder. such as:
Next, we then enter the dotnet new Mvc-n mycms.webin the integration terminal, after the VS code a burst of struggle and toss, we will find a list of files on the left is a more MVC project called Mycms.web. Such as:
Five, good, below we try to press the F5 key after what happens? Ha ha...... A little disappointed that the program did not run directly. Instead, there was a ghost thing like this. Well, we choose. NET Core
Six, again hard pressed F5, Yi, I go, come out a Launch.json, such as:
Seven, it seems that this thing still can not get up, then let us first generate it? Well, for example, enter the command in the integration Terminal dotnet build mycms.web command, enter, finish afterwards became a thing under Debug. Well, let's put this build in the program of the Launch.json . NET Core Launch (web) configuration item and change the cwdbelow. After that, it looks like the effect is the following:
Eight, click on the left side of the bug, VS code in the left side will appear in the case, select . NET Core Launch (web), again press F5, or not, and it tells us what else to get a ghost thing:
Nine, click "Configure Task Run Program", automatically generated the following configuration JSON file:
Ten, well, let's now configure the newly generated Task.json. That is, add the following in the tasks configuration item to specify the direct command object at the time of the build. ${workspaceroot} means the root directory of your project, do not write absolute path ah, otherwise you will not find anything after the project release Don't Blame me.
"Options": {"CWD": "${workspaceroot}/mycms.web"} after the configuration, the effect is as follows: 11, this time we have to press the F5 key-------------Magic , A. Net Core MVC site that has begun to take shape appears before our eyes. Do you feel so bad? Haha, OK, joking, this site also look at the effect, back to the actual development of our project when Ah, the inside of the things will basically be deleted, leaving a shell. such as: 12, PostScript: There are a lot of things I do not know what the meaning, anyway, I have been tossing the project for a long time to run up, than in Visual Studio 2017 in the development of more trouble. However, in this way, after slowly tossing more, you and I also understand. Not afraid, Ah!
Using vs code to develop a. Net Core 2.0 MVC Web application tutorial