I have Jenkins running to build .NET projects. However sometimes restoring nuget packages fails because Jenkins cannot find the version of the package.
When I run the command manually in an elavated command prompt it works just fine, so the version of the package it is expecting is present in the NuGet repository. Also in Visual studio the build just works fine.
I’ve checked, and the account that Jenkins is using is part of the local administrators group.
The package is part of our local NuGet server.
The command I execute:
dotnet build -c Release --source https://nuget.intern.xxxxx.nl/nuget --source https://api.nuget.org/v3/index.json
The error I get:
D:\Jenkins\workspace\....\myproject.csproj : error NU1102: Unable to find package xxxx.DomeinEnValidatie.Monitor with version (>= 6.0.76)
D:\Jenkins\workspace\....\myproject.csproj : error NU1102: - Found 72 version(s) in https://nuget.intern.xxxx.nl/nuget [ Nearest version: 6.0.73-PreRelease ]
D:\Jenkins\workspace\....\myproject.csproj : error NU1102: - Found 0 version(s) in nuget.org```
When you say elevated command prompt, do you mean one running as an admin user? Is the user that Jenkins is running under an admin user and does your job run in an elevated shell? Why do you need an elevated command prompt to run your command manually? Can you dump the build information to a structured build log and then see if there are any clues using the Structure Build Log Viewer (https://msbuildlog.com/)? Is there any sort of intermittent network issue on that build agent?
When you say elevated command prompt, do you mean one running as an admin user?
Yes. Reason is the user which I use to logon to the buildserver is minimal rights. So I need to use the admin user. When I add the user I login with the the local admin group I don’t need to use the elevatged prompt, but then also the build succeeds.
Is the user that Jenkins is running under an admin user and does your job run in an elevated shell?
Yes, the user Jenkins is running under is part of the local administrators group.
Can you dump the build information to a structured build log
I can’t as I don’t use msbuild, but dotnet build
. All information it is providing in the output I already included in my question. There is no more information. And because when I manually run the build it works, it is hard to get more information.
Is there any sort of intermittent network issue on that build agent?
Not that I’m aware of. Also the NuGet repository we are using is running local on our build server, where the build agent is also running. So it should have no issue reaching the NuGet server.
It sounds like the user that the Jenkins agent is running as needs to an admin user. You said the build succeeds if running as an admin user, it sounds like that is needed. I don’t know of any way to avoid that if it doesn’t work without admin rights.
As stated in my opening post, the user Jenkins is using is part of the local administrators group.
Also I now noticed that after waiting for a day Jenkins suddenly does see the NuGet version it needs.
Is there anykind of solution to this issue? We also ran into this issue.
Have you tried adding --no-cache
to the command line?