I am trying JetBrains Rider for my existing .NET Core project. In the project I have several appsettings.json
overrides:
appsettings.Development.json
- for developmentappsettings.Test.json
- for testingappsettings.Staging.json
- for staging environmentIn Visual Studio, the overrides work perfectly and I always get my Development override, when running the app in debug mode. However, in Rider I am getting the default appsettings.json
values, which are not suitable for debugging and development. How do I change the settings to get the values from the correct override?
Add environment variablesFrom the main menu, select Run | Edit Configurations or choose Edit Configurations from the run/debug configurations selector on the toolbar. In the Run/Debug Configurations dialog, select a configuration where you want to add the environment variables.
launchSettings. json, which is placed in the Properties folder of a project, describes how the application can be launched — the command to execute, whether the browser should be opened, which environment variables should be set, and so on.
With all these packages installed, I could initialize the ConfigurationBuilder with a subset of the default ASP.NET Core setup: var environment = Environment. GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); var builder = new ConfigurationBuilder() . AddJsonFile($"appsettings.
You'll need to set the ASPNETCORE_ENVIRONMENT
environment variable.
To do this, create separate configurations for each environment:
Then click Edit Configurations
I create one for each env - and specify the Environment variable as appropriate:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With