dotnet / dotnet/msbuild

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

Open
#13,253 1 comment 0 reactions 0 assignees View on GitHub
Area: Debuggability BuildCheck Suggestion needs-design triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

### Summary

In https://github.com/dotnet/sdk/issues/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_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.