Skip to content

Inject DOTNET_CLI_USE_MSBUILD_SERVER env var for apphost builds and runs, using configuration for value #9945

Closed
@mitchdenny

Description

@mitchdenny

This issue tracks the enhancement to the Aspire CLI to always set the DOTNET_CLI_USE_MSBUILD_SERVER environment variable for all dotnet build and dotnet run (when noBuild == false) calls for apphost projects. The key technical implementation details are as follows:

Technical Implementation Details

  1. Always inject the DOTNET_CLI_USE_MSBUILD_SERVER environment variable into the environment dictionary passed to the build/run process for apphost builds.
  2. The value should be sourced from configuration["DOTNET_CLI_USE_MSBUILD_SERVER"]. This allows test scenarios to override the value using configuration.
  3. If configuration["DOTNET_CLI_USE_MSBUILD_SERVER"] is not set, default the value to "true".
  4. Do not check for or rely on any preexisting value in the env dictionary passed to the runner; always explicitly set the variable.
  5. In DotNetCliRunner:
  6. In BuildAsync(...): Always inject the variable before calling ExecuteAsync.
  7. In RunAsync(...): Inject the variable only if noBuild == false, before calling ExecuteAsync.
  8. Ensure that the DotNetCliRunner has access to an IConfiguration instance, either via dependency injection or other means.
  9. Update or add tests to ensure:
  • The variable defaults to "true" when not set in configuration.
  • The variable can be overridden via configuration for testing or explicit opt-out.
  • The environment variable is always present in the effective environment used for the build/run process.

Metadata

Metadata

Assignees

Labels

needs-area-labelAn area label is needed to ensure this gets routed to the appropriate area owners

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions