2017-09-02 120 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美元 –

相關問題