Skip to content

Microsoft.Net.Sdk.Compilers.Toolset download check fails because NuGetPackageRoot is unset in some scenarios #43016

@jjonescz

Description

@jjonescz

Related to #41791 and #42087.

The error is:

NETSDK1216: Package Microsoft.Net.Sdk.Compilers.Toolset is not downloaded but it is needed because your MSBuild and SDK versions are mismatched. Ensure version {0} of the package is available in your NuGet source feeds and then run NuGet package restore from Visual Studio or MSBuild.

It happens because $(NuGetPackageRoot) is unset, hence <RoslynTargetsPath>$(NuGetPackageRoot)\microsoft.net.sdk.compilers.toolset\$(NETCoreSdkVersion)</RoslynTargetsPath> points to an invalid location, hence the download check fails.

For example, $(NuGetPackageRoot) is unset in these scenarios:

In the following, the toolset package download was completely disabled likely because it was failing due to this bug:

Similar issue:

A workaround for this issue is being added in #42860.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions