". NET Core" in Win10 vs Code debug

Source: Internet
Author: User
Tags dotnet net command

Although the Windows platform has a rich and powerful visual Studio, but sometimes a little bloated, not as good as vs Code (VSC) Small and convenient, no nonsense, go straight to the point

Prerequisites
    1. . NET Core RC2
    2. X64 system
    3. Windows 7+
Install vs Code

Download and install from official website, if VSC is already installed, make sure the version number is at least 0.10.10

installation. NET command-line tools

Installing the VSC C # extension

, if the download is not smooth please FQ, with VSC open a little while you can automatically install complete. After the installation is complete, the VSC will automatically download the required debug and edit files for the corresponding platform when it is restarted.

Debug Steps
    1. Build the app (you already have the appropriate application to ignore this step)

Execute the following command in the project folder

dotnet new

Open Project.json After completion, modify MICROSOFT.NETCORE.APP version to 1.0.0-rc2-24008

{  "version": "1.0.0-*",  "compilationOptions": {    "emitEntryPoint": true,    "debugType": "portable"  },  "dependencies": {    "Microsoft.NETCore.App": {      "type": "platform",      "version": "1.0.0-rc2-24008"    }  },  "frameworks": {    "netcoreapp1.0": {}  }}

Here to add Debugtype in order to use the PDB file (only the Windows platform needs to add this line, the official said will be unified with Mac/linux, but there is no definite date

    1. Restore Package

Open C:\Users\Brian\AppData\Roaming\NuGet\NuGet.Config, add two NuGet sources under the Packagesources node

<add key="dotnet-core" value="https://www.myget.org/F/dotnet-core/api/v3/index.json" /><add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />

Execute the following command in the project folder

dotnet restore
    1. Installing debugger

Open the project folder with VSC and wait a moment. VSC will automatically complete the download installation

    1. Debug

Press F5 or click the Debug green Arrow, at which time VSC will automatically create two files, Launch.json and Task.json

Task.json Modify as follows

{    "version": "0.1.0",    "command": "dotnet",    "isShellCommand": true,    "args": [],    "tasks": [        {            "taskName": "build",            "args": [ ],            "isBuildCommand": true,            "problemMatcher": "$msCompile"        }    ]}

Launch.json need to modify the program line and for the corresponding folder and file name, for example, stopatentry default is False, I changed to true, so that the start of the app execution will automatically stop

{"version": "0.2.0","configurations": [{"name": ".NET Core Launch (console)","type": "coreclr","request": "launch","preLaunchTask": "build","program": "${workspaceRoot}/bin/Debug/netcoreapp1.0/MyApplication.dll","args": [],"cwd": "${workspaceRoot}","stopAtEntry": true}]}

Press F5 again, you can debug it ~

Happy coding!

. NET Core in Win10 with vs Code debug

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.