Skip to content

Fix azure pipeline error: NU1101 #165

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

Closed
wants to merge 2 commits into from
Closed

Fix azure pipeline error: NU1101 #165

wants to merge 2 commits into from

Conversation

nonsensation
Copy link

@nonsensation nonsensation commented Jun 30, 2020

Just saw #162, might be the better option to go with


You mentioned in your last stream (around min14:00) the Azure error
error NU1101: Unable to find package, which I had myself earlier, while coding along.
I googled it and found this entry: https://developercommunity.visualstudio.com/content/problem/986056/azure-pipelines-hosted-agent-dotnetcorecli.html which suggests to run the nuget-installer in the pipeline and restore packages.
This fixed it for me, however I have only limited knowledge on azure.

@fredrikhr
Copy link
Contributor

fredrikhr commented Jul 9, 2020

The problem with this bug is that it is non-deterministic and as far as I have seen across several hundreds of CI runs in the last week there is no discernable pattern.

So adding a step to the pipeline that does the restore first (which is my normal setup anyways) does not solve the issue. One or two times the pipeline might run successfully, but thus far it has come back to haunt me later. I cannot really think that doing the nuget tool install helps much either, can you confirm this solve over multiple runs?

The only reliable way this far that I have seen (confirmed over approx. 80 CI runs in various independent repositories) is to use the solution I propose in #162.

@fredrikhr
Copy link
Contributor

Furthermore, the CI pipeline we use in the repo only uses the .NET SDK. The NugetToolInstaller@1 task essentially just downloads the nuget.exe command-line binary from nuget.org. However, the .NET SDK does not use nuget.exe at all for package restoration, so having the tool there should not affect the SDK at all.

The way the .NET SDK restores packages (either implicitly when running dotnet build or when running dotnet restore) is through a couple of MSBuild task-assemblies that are contained in some folder within the SDK. Essentially these assemblies are variants of the NuGet SDK and provide the .NET SDK with the same functionality as the CLI tool, but integrated into the MSBuild workflow.

Given this, I doubt that downloading nuget.exe using the NugetToolInstaller@1 task has any affect at all, and any successful build using this is simply lucky.

Note, that I am not dismissing the NugetToolInstaller@1 task for other pipelines out there. Some CIs use older versions of MSBuild (without the .NET Core SDK) and in these cases they rely on the nuget.exe tool being present. This fix simply does not apply to our particular pipeline we use in this repo.

@nonsensation
Copy link
Author

Thanks for your input @fredrikhr. I just had the same issue with the build, googled it and this fixed it for me. I've run the CI for a couple of times (~like 20x) and it worked this far. However you have more knowledge on this, so I will close this PR and use your #162 instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants