-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
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:
msbuild.exe '/t:Restore;Build'
(but it's fine when running with/restore /t:Build
)- in the inner build started by task
GenerateTemporaryTargetAssembly
when building WPF on .NET Framework
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.