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:
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.
Related to #41791 and #42087.
The error is:
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)GenerateTemporaryTargetAssemblywhen building WPF on .NET FrameworkIn 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.