Closed morindo closed 7 months ago
@morindo Thanks for flagging this. I've done some testing and it looks like whatever logic/code VS uses to launch IISExpress, does not add the environmentVariables when in the MSBuild.SDK.SystemWeb
.
It does not appear to be a difference relating to hosting dotnet core vs dotnet framework in IIS itself (which was actually my first though) but actually something in the launch code.
This bit of code is built into VS itself, so I can't easily debug or find what/why it doesn't work as expected.
I've also done a bit of testing with launchSettings.json
/ launch profiles for console apps, and it seems to work with both net6 and net48 (framework) and correctly set the environment variables as expected. (This is with commandName
set to Project
).
I'll see if I can dig into this a bit more, but it might need some help from the VS team here.
Thank you very much @CZEMacLeod for the quick response. Good hunch, I'll look into-it myself. I'll post if I find something.
@morindo @CZEMacLeod any progress on this?
@swissarmykirpan unfortunately, I didn't find a way to make IISExpress use the launchSettings.json environment variable.
Ran into this behavior today. @CZEMacLeod should this be tagged with the known limitation
label?
Additionally, is there any known workarounds to this issue besides just forcing a system-wide environment variable?
Our current Web app csproj is currently using the great (and thank you so much) MSBuild.SDK.SystemWeb/4.0.88 Sdk and when we launch the IIS Express profile (in debug or without debugging) from VS 2022, it does add the environment variables to the iisexpress.exe process, is this normal? Notice that it is working with a default ASP.NET Core Web App default project.
This is our launchSettings.json