2017-09-02 131 views
1

我是一个新手,使用Angular 4,但我配置了一个项目以使用Angular 4和Asp.Net Core 2.0。 我的问题是,当我在Visual Studio代码中按下F5时,我可以调试我的C#文件,但不能打印我的脚本代码。使用Angular 4在vscode中调试Asp.Net核心应用程序

网络主人如何做到这一点?任何不同的工作方式,或在.vscode文件夹的launch.json和tasks.json上的其他设置?

这里的项目网址:https://github.com/otaviolarrosa/VirtualStore

我launch.json文件:

{ 
"version": "0.2.0", 
"configurations": [ 
    { 
     "name": ".NET Core Launch (web)", 
     "type": "coreclr", 
     "request": "launch", 
     "preLaunchTask": "build", 
     "program": "${workspaceRoot}/VirtualStore/bin/Debug/netcoreapp2.0/VirtualStore.dll", 
     "args": [], 
     "cwd": "${workspaceRoot}/VirtualStore", 
     "stopAtEntry": false, 
     "launchBrowser": { 
      "enabled": true, 
      "args": "${auto-detect-url}", 
      "windows": { 
       "command": "cmd.exe", 
       "args": "/C start ${auto-detect-url}" 
      }, 
      "osx": { 
       "command": "open" 
      }, 
      "linux": { 
       "command": "xdg-open" 
      } 
     }, 
     "env": { 
      "ASPNETCORE_ENVIRONMENT": "Development" 
     }, 
     "sourceFileMap": { 
      "/Views": "${workspaceRoot}/Views" 
     } 
    }, 
    { 
     "name": ".NET Core Attach", 
     "type": "coreclr", 
     "request": "attach", 
     "processId": "${command:pickProcess}" 
    } 
]} 

和我tasks.json文件:

{ 
// See https://go.microsoft.com/fwlink/?LinkId=733558 
// for the documentation about the tasks.json format 
"version": "2.0.0", 
"tasks": [ 
    { 
     "taskName": "build", 
     "command": "dotnet build", 
     "type": "shell", 
     "group": "build", 
     "presentation": { 
      "reveal": "silent" 
     }, 
     "problemMatcher": "$msCompile" 
    } 
]} 

回答

3

来调试应用程序Angular4最好的方法是在运行应用程序的浏览器中。在开发模式中,Angular4创建源图文件。在例如Chrome浏览器可以浏览类似于Angular应用程序路径的源代码。你也可以在这里设置断点。

对角2+应用一个非常酷的调试工具是Augury

所以调试C#中VSCODE和您的角应用在Chrome

+0

非常感谢家伙!我现在只是在做。 和Augury是一个非常棒的工具,可以和Angular一起工作! 我很感谢:) –

+0

我做了一个关于Udemy的角度4课,由Maximillian schwarzmuller完成。如果你是Angular的新手,那么值得。 26小时的教程费用为10美元 –

相关问题