Skip to content

Bootstrap MSBuild unable to build console projects: unable to resolve workload SDKs #7988

Description

@KirillOsenkov

Prep a bootstrap MSBuild layout using build /p:CreateBootstrap=true
or download the one I used from:
https://kirillosenkovfiles.blob.core.windows.net/kirillosenkovblob/msbuild.17.3.1.zip

Be on an empty Windows machine, such as Windows Sandbox VM

Create and build a new C# console app targeting net472

Expected: builds successfully

Actual:

Build FAILED.

  C:\Users\WDAGUtilityAccount\AppData\Local\Bootstrap\MSBuild\Sdks\Microsoft.NET.Sdk\targets\Mic
rosoft.NET.Sdk.ImportWorkloads.props(14,3): error : Unable to locate the .NET SDK. Check that it is installed and that
the version specified in global.json (if any) matches the installed version.
  C:\Users\WDAGUtilityAccount\AppData\Local\Bootstrap\MSBuild\Sdks\Microsoft.NET.Sdk\targets\Mic
rosoft.NET.Sdk.ImportWorkloads.targets(16,3): error : Unable to locate the .NET SDK. Check that it is installed and tha
t the version specified in global.json (if any) matches the installed version.

The two SDKs it can't resolve:

Resolving SDK 'Microsoft.NET.SDK.WorkloadAutoImportPropsLocator'...
Resolving SDK 'Microsoft.NET.SDK.WorkloadManifestTargetsLocator'...

First off, the error messages are inadequate - they don't mention the SDK reference that failed to resolve.

Both of these are supposed to resolve from:
https://github.com/dotnet/sdk/blob/3dc5e528fffc050cace4cff8bc32954eb33f0455/src/Resolvers/Microsoft.NET.Sdk.WorkloadMSBuildSdkResolver/CachingWorkloadResolver.cs#L121-L136

However on an empty machine with just the xcopied MSBuild something goes awry apparently and it fails with the obscure messages above.

Until recently, the bootstrap MSBuild was xcopyable, meaning it used to build desktop-targeting projects on a completely empty Windows machine.

At some point this regressed. It is crucial that we continue to be able to have xcopyable MSBuild and we should move towards making MSBuild more portable, not less.

Metadata

Metadata

Labels

Area: Our Own BuildProblems affecting the build or build infrastructure of the MSBuild repo itself.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions