Skip to content

Flag when users run builds with key environment variables set to likely-wrong locations #13253

@baronfel

Description

@baronfel

Summary

In dotnet/sdk#53005 a user was running builds with MSBuildExtensionPaths set to C:\Program Files (x86)\MSBuild - a location that very likely didn't exist or would not have worked for them. We should detect scenarios where incorrect or missing critical paths are involved in the build and fail or raise warnings earlier on.

Background and Motivation

If we can detect invariants/key dependencies earlier on (e.g. MSBuildExtensionsPath is specified but does not exist, or the MSBuild Sdks root is specified, does not exist, and is needed) and raise those to users so they don't end up running hopeless builds.

Proposed Feature

We should have logic in the common targets and/or the engine that validates the existence of the critical locations:

  • MSBuildExtensionsPath
  • MSBuildSDKsPath

If these locations do not exist (and are required for the build, so always for MSBuildExtensionsPath and when resolving SDKs for MSBuildSDKsPath) then we should log an error.

In addition, if these locations are set to unexpected locations (i.e. outside the SDK/VS install roots/etc, we should have a buildcheck or something to flag that - any use outside of those contexts is very likely incorrect.

Alternative Designs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: DebuggabilityIssues impacting the diagnosability of builds, including logging and clearer error messages.BuildCheck SuggestionSuggestion for a built in MSBuild analyzer. Label should be applied together with 'Area: BuildCheck'needs-designRequires discussion with the dev team before attempting a fix.triaged

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions