Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Any tips for using VS Code with Angular 7 and appsettings.{variable}.json configurations? #6532


User avatar
0
commondesk created

Hi,

We're using Angular 7 and TypeScript and found that VS Code is a really fast way to get up and running. Typescript debugging worked immediatly and the editor is really fast. We've decided to continue to run Visual Studio for debugging the backend and use VS Code to launch and debug the front end.

The problem were having is. How to intergrate with the appsettings.{variable}.json and appconfig.{variable}.json? This works perfectly in Visual Studio but but VS Code see's them as seperate files.

If we have a single file for appsettings.json and appconfig.json everything works. But then each develeloper must update everything everytime you update from source control. As usual, you forget something and spend 10 min tracking it down.

So today we attempted to use angular.json > configurations > fileReplacments but we cant get it working, and even it it was to work, it would never support the inheritance of properys between the appsettings.json and the appsettings.{variable}.json.

Anyone have any suggestions??

Thanks


3 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    ng build --env=prod then environment.prod.ts will be used instead.

    For the .net core application, you can set it in launch.json

    "env": {
        "ASPNETCORE_ENVIRONMENT": "Development"
    }
    
  • User Avatar
    0
    commondesk created

    for my version of angular CLI the --env is not valid but you can use --configuration.

    Also will setting ASPNETCORE_ENVIRONMENT change the use of appsettings.json ??

  • User Avatar
    0
    ismcagdas created
    Support Team

    Also will setting ASPNETCORE_ENVIRONMENT change the use of appsettings.json ??

    @commondesk , Yes.