1、目录结构
2、运行此命令还原新建MVC文件结构
dotnet new sln -n 项目文件名称不带后缀名 cd Web文件夹名称 dotnet new mvc
生成对应的dll文件
3、配置launch.json
1 { 2 // 使用 IntelliSense 了解相关属性。 3 // 悬停以查看现有属性的描述。 4 // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 5 "version": "0.2.0", 6 "configurations": [ 7 { 8 "name": ".NET Core Launch (web)", 9 "type": "coreclr", 10 "request": "launch", 11 "preLaunchTask": "build", 12 "program": "${workspaceFolder}/Web文件夹名称/bin/Debug/netcoreapp2.0/Web文件夹名称.dll", 13 "args": [], 14 "cwd": "${workspaceFolder}/Web文件夹名称", 15 "stopAtEntry": false, 16 "internalConsoleOptions": "openOnSessionStart", 17 "launchBrowser": { 18 "enabled": true, 19 "args": "${auto-detect-url}", 20 "windows": { 21 "command": "cmd.exe", 22 "args": "/C start ${auto-detect-url}" 23 }, 24 "osx": { 25 "command": "open" 26 }, 27 "linux": { 28 "command": "xdg-open" 29 } 30 }, 31 "env": { 32 "ASPNETCORE_ENVIRONMENT": "Development" 33 }, 34 "sourceFileMap": { 35 "/Views": "${workspaceFolder}/Views" 36 } 37 }, 38 { 39 "name": ".NET Core Attach", 40 "type": "coreclr", 41 "request": "attach", 42 "processId": "${command:pickProcess}" 43 } 44 ] 45 }
4、修改配置tasks.json文件
1 { 2 // See https://go.microsoft.com/fwlink/?LinkId=733558 3 // for the documentation about the tasks.json format 4 "version": "2.0.0", 5 "tasks": [ 6 { 7 "label": "build", 8 "command": "dotnet build", 9 "type": "shell", 10 "group": "build", 11 "presentation": { 12 "reveal": "silent" 13 }, 14 "options":{ 15 "cwd": "${workspaceRoot}/Web文件夹名称" 16 }, 17 "problemMatcher": "$msCompile" 18 } 19 ] 20 }
至此就可以愉快的debug运行!^_^
原文地址:https://www.cnblogs.com/qishidz/p/8478570.html
时间: 2024-10-18 23:50:29