Can't set environment variables for .net launch settings profile

Answered

I created a new .net core 2.2 project using the empty asp.net template in rider.  What I want to do is ensure the port is the same each time I run.  (For now so I can use the rest client to test it, but later for integration testing.)

I believe the way I'm supposed to fix this is to add an environment variable ASPNETCORE_URLS with the url.

Fine, so I click Edit Configurations, and then press the icon next to Environment Variables.  It pops up and shows me ASPNETCORE_ENVIRONENT set to Development.  But the little toolbar which lets me add environment variables is missing.  After a bit of prodding about, I find the keyboard shortcut and add the new setting in.  But when I close the dialog, the new key disappears.

I'm reasonably sure this configuration was added by Rider when I created the project, or when I chose to run it.

What I noticed is that this configuration is a ".NET Launch Settings Profile" type.  If I create a new configuration using ".NET Project' then the environment variables window works fine.  I'm not sure I know what the difference is.

So maybe this is the answer, but I'm sure this behaviour can't be correct can it??

I'm using 2018.3 with OSX Mojave.

4 comments

Ah, 2 minutes after posting this I stumbled on what I think the answer is... there's a launchSettings.json file under Properties that seems to be where I'm supposed to configure this I think.

I've not spent much time with .net core before and must admit, it's all quite confusing.  There seem to be a lot of different ways to configure the same thing.  I've not yet figured out what the differences are.

0

Hi John,

Yes, you got it right. Starting from v2018.3 Rider has a new type of run configuration, which is generated from launchSettings.json: https://blog.jetbrains.com/dotnet/2018/11/08/using-net-core-launchsettings-json-rundebug-apps-rider/. That is why some of the fields are not editable from the dialog.

The main difference between ".NET Project" and ".NET Launch Settings Profile" is that the first one is saved in .idea folder (IntelliJ way) and the second one in launchSettings.json (.NET Core way).

0

I eventually found out when I actually read the dialog properly!  Before I was just honing in on the environment variables, which is what I thought I wanted, and was then confused when it didn't really work properly.

 

I wonder if it's worth changing it so that the editor can modify launchsettings.json, or alternatively if the edit button takes you to the json file in the editor.

0

John,

Thanks for sharing your thoughts! Please upvote this issue on YouTrack: https://youtrack.jetbrains.com/issue/RIDER-23217

0

Please sign in to leave a comment.