microsoft / vscode-dotnettools

This is a feedback repository to capture issues logged for the C# Dev Kit and related extensions from Visual Studio Code
Other
210 stars 7 forks source link

[SUGGESTION] Maui build env variable #868

Open cl3m opened 6 months ago

cl3m commented 6 months ago

Describe the feature you'd like

Is it possible to send env variable to the "maui: Build" task ? I would like to do something like the following launch.json

{
  "name": "Debug Prod",
  "type": "maui",
  "request": "launch",
  "preLaunchTask": "maui: Build", 
  "configuration": "Debug",        
   "env": {
     "ENVIRONMENT": "Prod",
   },    
}

And then get this environment value in MSbuild.

Alternatives considered

I've tried to use a Debug-Prod configuration and it almost works but it seems there is some magic in the Debug configuration that I could not emulate to run correctly on device.

Environment Information

macOS maui latest vscode | VS Bug 2000463

Michael-Eng commented 6 months ago

I believe global env variables are passed along to msbuild but I'm adding the maui area in case there are other options for maui projects

yaliashkevich commented 5 months ago

Custom configurations in sdk style projects are fragile and unreliable. You can not "inherit" from Debug or Release configurations, but have to replicate all properties setup which depends on Debug|Release configuration in targets/props files of net/ios/android/maui sdks. No guarantee "replication" will work after sdk/workload update.

So ability to setup custom env property (set msbuild property) is really appreciated.