ignore or Specify Properties/launchSettings.json setting
See original GitHub issueEnvironment data
dotnet --info
output:
.NET Core SDK (reflecting any global.json):
Version: 2.1.505
Commit: b220231234
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18362
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.505\
Host (useful for support):
Version: 2.1.9
Commit: dcedc87d22
.NET Core SDKs installed:
2.1.505 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
VS Code version:
Version: 1.35.1 (user setup)
Commit: c7d83e57cd18f18026a8162d042843bda1bcf21f
Date: 2019-06-12T14:30:02.622Z
Electron: 3.1.8
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Windows_NT x64 10.0.18362
C# Extension version:
Name: C#
Id: ms-vscode.csharp
Description: C# for Visual Studio Code (powered by OmniSharp).
Version: 1.20.0
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-vscode.csharp
Steps to reproduce
.vscode/launch.json‘s setting below:
{
"name": "SplitPackageWeb",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "buildWebHost",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/aspnet-core/src/SplitPackage.Web.Host/bin/Debug/netcoreapp2.1/SplitPackage.Web.Host.dll",
"args": [],
"cwd": "${workspaceFolder}/aspnet-core/src/SplitPackage.Web.Host",
"stopAtEntry": false,
"launchBrowser": {
"enabled": true
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_URLS": "http://+:8070",
"ConsulConfig__IsRegister": "false"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
}
my host project Properties/launchSettings.json‘s setting below:
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:8070/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchUrl": "http://localhost:8070",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ConnectionStrings__Default": "Server=127.0.0.1; port=3307; Database=SplitPackageDb; uid=root; pwd=root; Convert Zero Datetime=True"
}
},
"SplitPackage.Web.Host_local": {
"commandName": "Project",
"environmentVariables": {
"ASPNETCORE_URLS": "http://+:8070",
"ASPNETCORE_ENVIRONMENT": "Development",
"ConnectionStrings__Default": "Server=127.0.0.1; port=3307; Database=SplitPackageDb; uid=root; pwd=root; Convert Zero Datetime=True"
}
},
"IIS Express_Test": {
"commandName": "IISExpress",
"launchUrl": "http://localhost:8070",
"environmentVariables": {
"ConnectionStrings__Default": "Server=192.168.1.230; port=3306; Database=SplitPackageDb; uid=root; pwd=Qjkj2018; Convert Zero Datetime=True",
"ASPNETCORE_ENVIRONMENT": "Test"
}
},
"SplitPackage.Web.Host_Test": {
"commandName": "Project",
"environmentVariables": {
"ConnectionStrings__Default": "Server=192.168.1.230; port=3306; Database=SplitPackageDb; uid=root; pwd=Qjkj2018; Convert Zero Datetime=True",
"ASPNETCORE_URLS": "http://+:8070",
"ASPNETCORE_ENVIRONMENT": "Test"
}
}
}
}
Expected behavior
Project uses environment variables to change application configuration.when I start debug app, I hope the Properties/launchSettings.json setting can’t not be use, because my colleagues use multiple configurations to distinguish between local and test environments on VS2017. there are two project setting in the profiles node. I can ignore Properties/launchSettings.json setting or Specify which configuration to use?
Actual behavior
Properties/launchSettings.json’s node SplitPackage.Web.Host_local
is applied.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:11 (2 by maintainers)
Top Results From Across the Web
How do I use gitIgnore to ignore launchSettings.json?
gitignore, cut the file to another directory, commit the .gitignore and file deletion change, then bring your settings file back. Share.
Read more >ASP.NET Core launchSettings.json File - Dot Net Tutorials
In this article, I am going to discuss the ASP.NET Core launchSettings.json File. launchSettings.json file contains project specific settings.
Read more >launchSettings.json - Visual Studio for Mac - Microsoft Learn
To get to the project options, right-click your project and select Options. Select Run > Configurations > Default.
Read more >Using .NET Core launchSettings.json to run/debug apps in Rider
Run/debug configurations that are generated from a launchSettings.json file can be edited. Via the toolbar or the Run | Edit Configurations…
Read more >launchSettings.json & Debug Profile in ASP.NET Core
Select Project · Right Click and click on Property option · Select Debug Tab · Click on the New button · Enter the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Is this in the pipeline, or is there some other approach that might resolve the following?
Working together where some are using VS and others VSCode, we have our local run options defined via various profiles in
Properties/launchSettings.json
. Debugging in VS has the option of picking one of the profiles via a dropdown. When running viadotnet run
I can supply the--launch-profile
parameter specifying the profile inlaunchSettings.json
that I want to use - or leave it out and go with the top one. Debugging in VSCode, however, I’d assumed that I could add the--launch-profile
asargs
in launch.json - which does not work, it just always picks the top one.I’m really missing the ability to be able to specificy
--launch-profile
for a launch.json configuration, or being presented with a profile picker (similar tocommand:PickProcess
).Any news on this? My team is a mixed environment when some people use VS 2019 and others use VSCode + devcontainers, which requires differences in some environment variables. Having the ability to ignore
launchSettings.json
files in VSCode would help a lot