-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
catch-22 regarding running dotnet restore
vs. dotnet workload restore
first
#45447
Comments
More reason to get traversal and notargets SDKs into the MSBuild core @rainersigwald :-/ @AArnott I think as a workaround if you know the workloads you require you can explicitly call 'dotnet workload install ' to get around this. All workload restore does is call a target to try and determine this list on your behalf, so calling install yourself will be strictly faster not to mention not requiring the 'dotnet restore' to have completed. |
Thanks for the suggestion. I'm working around this by running |
When the MSBuild traversal SDK is not already installed, `dotnet workload restore` fails. When I run `dotnet restore` first (to place the SDK) it fails saying I must first run `dotnet workload restore`. By running `dotnet workload restore` _first_, targeting the sln file instead of the traversal project, I avoid the traversal SDK dependency, allowing workload restore to succeed, which then allows a subsequent traversal project-based `dotnet restore` to succeed. See also dotnet/sdk#45447
Moving to the backlog for now pending the traversal sdk work. We could also consider a way of hardcoding the workloads you wanted for restore or changing how workload restore gets the list but holding off on that investment for now. |
That's fine. I have a workaround. But IMO it's bigger than the traversal SDK. In general, a project that uses any MSBuild SDK and requires a dotnet workload is SOL. I can workaround it because these two requirements for me are in different projects, so I can focus my Alternatively, a workaround as @baronfel mentioned is to manually install with |
Linking #45216 because it's probably my preferred approach to the problem.
|
Describe the bug
My CI build is broken on some agents because there seems to be a catch-22 regarding whether to run
dotnet restore
ordotnet workload restore
first.If I run
dotnet restore
first, it errors out saying "error NETSDK1147: To install these workloads, run the following command: dotnet workload restore".If I run
dotnet workload restore
first, it errors out saying "The SDK 'Microsoft.Build.Traversal' specified could not be found."Yes, I have traversal projects. And in fact the root of my restore operation is a
dirs.proj
.To Reproduce
I suspect all you need is a dirs.proj that points to a project that requires android, iOS or anything else requiring a workload.
Then, on a computer that does not already have a nuget cache with
Microsoft.Build.Traversal
or the required workload installed, try restoring.Further technical details
SDK Version: 9.0.100
This happens on mac, windows and linux agents. These are custom agents, BTW, so they don't have a bunch of workloads pre-installed as the Azure Pipelines Hosted agents may have.
The text was updated successfully, but these errors were encountered: