如何将VS代码launch.json转换为Visual Studio launchSettings.json for .Net核心Web应用程序

我需要将VSCode中的launch.json文件转换为Windows上的Visual Studios中的launchSettings.json文件,以便我可以使用Docker进行debugging。 下面是我在VSCode中工作的launch.json文件。

{ "version": "0.2.0", "configurations": [ { "name":".NET Core Docker Launch (web)", "type": "coreclr", "request": "launch", "preLaunchTask": "composeForDebug", "cwd": "/app", "program": "/app/test.dll", "sourceFileMap": { "/app": "${workspaceRoot}" }, "launchBrowser": { "enabled": true, "args": "${auto-detect-url}", "windows": { "command": "cmd.exe", "args": "/C start ${auto-detect-url}" }, "osx": { "command": "open" } }, "pipeTransport": { "pipeProgram": "/bin/bash", "pipeCwd": "${workspaceRoot}", "pipeArgs": [ "-c", "./dockerTask.sh startDebugging" ], "windows": { "pipeProgram": "${env.windir}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", "pipeCwd": "${workspaceRoot}", "pipeArgs": [ ".\\dockerTask.ps1", "-StartDebugging" ] } } } ]} 

下面是我的Windows端Visual Studio中的launchSettings.json文件。 它几乎与在Visual Studio中创build新的.Net Core Web应用程序时生成的launchSettings.json文件相同。 当我尝试使用launchSettings.json文件进行debugging时,它允许我使用Docker进行debugging,但是出现“PrepareForLaunch”任务意外失败的错误。 我认为这是由于我的launchSettings.json文件中缺less一些configuration。

  { "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { "applicationUrl": "http://localhost:52667/", "sslPort": 0 } }, "profiles": { "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } }, "api": { "commandName": "Project", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, "applicationUrl": "http://localhost:52668" }, "Docker": { "launchBrowser": true, "launchUrl": "http://localhost:{ServicePort}" } } }