Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jjonescz opened this issue Aug 27, 2024 · 9 comments
Assignees
Labels
Area-NetSDK untriaged Request triage from a team member

Comments

@jjonescz
Copy link
Member

jjonescz commented Aug 27, 2024

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.

Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Request triage from a team member label Aug 27, 2024
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@icom85
Copy link
Member

icom85 commented Aug 29, 2024

Hello! I am getting the same error trying to build one of our solutions on a windows-latest agent inside Azure DevOps and with the latest .NET 9 SDK (9.0.100-preview.7.24407.12). We use the MSBuild@1 task to launch a classic msbuild project which does couple of other things and at the end tries to build the solution like this:

<Exec Command='$(MSBuild17ExePath) $(WinFormsNetCoreSolutionPath) /p:Configuration=$(NetCoreBuildConfiguration);Platform=&quot;$(WinFormsBuildPlatform)&quot;;WarningLevel=0;TreatWarningsAsErrors=false /t:Rebuild'/>

Is there a workaround, I see that one is mentioned above but could not figure out how to use it? Also, some of the related issues are now closed. Will a fix be available with a future preview version of .NET 9?

@icom85
Copy link
Member

icom85 commented Aug 30, 2024

It seems that /t:Restore;Rebuild did the trick and I am able to build on the agent.

@jjonescz
Copy link
Member Author

It seems that /t:Restore;Rebuild did the trick and I am able to build on the agent.

Doing /restore /t:Rebuild should be the best solution I think.

@KirillOsenkov
Copy link
Member

this basically breaks the build for all WPF desktop projects, let's make sure we fix this before the release if at all possible

@jjonescz
Copy link
Member Author

#43119 is a workaround for this - with that no builds should be broken except for a warning

@KirillOsenkov
Copy link
Member

hmm a warning is still a regression for all legacy WPF, this is concerning

@jjonescz
Copy link
Member Author

all legacy WPF

only if you are in a torn SDK state (i.e., a new SDK and an old MSBuild)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-NetSDK untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

7 participants
@KirillOsenkov @jjonescz @icom85 @MiYanni and others