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
- . NET Core RC2
- X64 system
- 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
- 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
- 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
- Installing debugger
Open the project folder with VSC and wait a moment. VSC will automatically complete the download installation
- 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