Open ViktorHofer opened 4 years ago
When we add this, we will also need to update VS to respect it as well. It doesn't directly use the Run
target, but instead looks for the $(RunCommand)
, $(RunWorkingDirectory)
, and $(RunArguments)
properties itself and then starts the process that way.
FYI - @davkean @BillHiebert
Thanks Eric for the correction. Do we know the intent of the Run
target and its potential consumers?
Looks like it came in with https://github.com/dotnet/sdk/pull/3820. Apparently there is a Run
target in the core MSBuild that people can run with msbuild /t:Run
. The above target is overriding the core Run
target, so it works correctly.
Noting here that since this issue was raised we've added Launch Profile support to dotnet run
- the --lp
/--launch-profile
option takes the name of the launch profile to use, and launch profiles support environment variable settings, etc. VS, VSCode and Rider all support these profiles.
We currently define the
RunCommand
,RunArguments
andRunWorkingDirectory
properties which are used when Visual Studio F5 invokes theRun
target. In case environment variables need to be passed in to the process invocation, a launchSettings.json file needs to be created in which you can specifyenvironmentVariables
.Adding a
RunEnvironmentVariables
property removes the necessity of adding a launchSettings.json file for such scenarios and works outside of Visual Studio as well (launchSettings.json are VS specific files).The proposed change would be added to the RunInformation section in the
Microsoft.NET.Sdk.targets
file: https://github.com/dotnet/sdk/blob/36ef8b2aa8e5d579c921704bdab69a7407936889/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets#L706-L758Example runsettings file with environment variables specified
cc @dsplaisted @eerhardt