【发布时间】:2018-01-21 23:17:13
【问题描述】:
我正在开发一个 ASPNET 核心 Web API 应用程序。当我尝试调试应用程序时,“appsetting.json”文件不会复制到调试文件夹中。此刻,每当我进行更改时,我都会复制此文件。如果我没有复制文件而只是运行dotnet run 命令,应用程序将无法加载,并给出未找到文件的异常。
我应该在 Launch.json 文件中做些什么吗?
这是我的。
我也试过添加
"/appsettings.json":"${workspaceFolder}/appsettings.json"
在此 JSON 文件中的 "sourceFileMap" 属性中但没有用。
请帮忙。
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "attach",
"name": "Attach to Chrome",
"port": 9222,
"webRoot": "${workspaceFolder}"
},
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/SmartAPI/bin/Debug/netcoreapp2.0/smartAPI.dll",
"args": [
],
"cwd": "${workspaceFolder}/SmartAPI",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart",
"launchBrowser": {
"enabled": true,
"args": "${auto-detect-url}",
"windows": {
"command": "cmd.exe",
"args": "/C start ${auto-detect-url}"
},
"osx": {
"command": "open"
},
"linux": {
"command": "xdg-open"
}
},
"requireExactSource": false,
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
}
]
}
【问题讨论】:
标签: c# asp.net json configuration appsettings