我的意图是使用与默认端口5000不同的端口启动VSCode调试器,为此,我在“ args”数组(命令行args)和ASPNETCORE_URLS env变量中都指定了url。我将以下launch.json配置用于Visual Studio Code调试器:
{
// 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": [
{
"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}/MotelsBack.API/bin/Debug/netcoreapp2.0/MotelsBack.API.dll",
"args": ["urls=http://localhost:6000"],
"cwd": "${workspaceFolder}/MotelsBack.API",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart",
"launchBrowser": {
"enabled": true,
"args": "${auto-detect-url}", …Run Code Online (Sandbox Code Playgroud) 我想获取使用C#的<Location>SourceFiles/ConnectionStrings.json</Location>子元素的值<PropertyGroup />。该文件位于.NET Core 2 classlib项目的.csproj文件中。结构如下:
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<Location>SharedSettingsProvider.SourceFiles/ConnectionStrings.json</Location>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)
我可以使用.NET Core库中的哪个类来实现这一目标?(不是.NET Framework)
更新1: 我想在应用程序(此.csproj文件生成)运行时读取值。部署之前和之后。
谢谢