2

I have service which is written in C# and I am trying to run it from visual studio for Mac. I can see the launchSettings.json file in my path. But due to some reason the environment variables in launchSettings.json is not loading at all. Everything seems to be working fine in Jetbrains rider. But not in VS for Mac.

It's not that it's not working at all. some times it does. But rider offers me a way to manually select a lauchsettings.json in case it's not detecting automatically and that's reliable. This how my typical launchsettings.json looks like. In rider I have an option to select Run -> Edit Configurations -> Add Configuration -> Launch Profile where I can select a launch profile in case it don't work. My project is an asp.net core api

{
    "profiles": {
        "Service Name": {
            "commandName": "Project",
            "launchBrowser": false,
            "environmentVariables": {
                "VAR_A": "TRUE",
                "VAR_B": "something",
                "SOME_KEY":"SOMEVAL"
            }
        }
    }
}

Also, thanks for the quick reply

Sumodh S
  • 709
  • 1
  • 14
  • 36
  • There is no IIS nor IIS Express on macOS, so not all profiles are valid there. – Lex Li Dec 02 '20 at 13:13
  • Which VS Mac version are you using? Also can you post your launchSettings.json file? – Matt Ward Dec 02 '20 at 16:51
  • 1
    The latest one 8.8 I think. I just updated it yesterday... I will post a retracted version of the launchSettings.json later. – Sumodh S Dec 03 '20 at 02:03
  • The VS for Mac version is 8.8.3 – Sumodh S Dec 03 '20 at 04:58
  • You can add/remove/edit the run configurations in VS Mac - which will update the launchSettings.json file. These can be found by right clicking the project and selecting Options - Run - Configurations. Also to pick a specific profile you can select it in the main status bar then when you run/debug it will use that profile. VS Mac only supports the Properties/launchSettings.json file in the project. – Matt Ward Dec 04 '20 at 17:32

1 Answers1

0

Right click on the launchsettings.json and go to properties. Change to

Build action: Content

Copy to directory: Copy if newer

Visual Studio should now see the launchsettings.json when running.