I'm setting a Jenkins CI server. I got the first step to run properly:
nuget restore -NonInteractive -ConfigFile Nuget.config -Verbosity Detailed -NoCache
That works properly, but when I want to compile the app with:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe
and ${WorkSpace}\src\Weather.App.csproj
It throws this error:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\NuGet\15.0\Microsoft.NuGet.targets(178,5): error : The package HockeySDK.Core with version 4.1.6 could not be found in C:\WINDOWS\system32\config\systemprofile\.nuget\packages\. Run a NuGet package restore to download the package. [C:\Program Files (x86)\Jenkins\workspace\MyApp\Weather\Weather.App.csproj]
The weird thing is that it the Hockey package clearly exists in the path:
If I run the same command IN my VS2017 local project, everything runs smoothly. But the jenkins server (which is in my same machine) does not build it properly.
Any ideas? Thanks
Here's the trick.
Put nuget.exe somewhere on he build server.
Ensure nuget.exe is in the PATH environment variable.
Restart Jenkins so that it picks up the updated PATH environment variable
Upgrade NuGet to the latest version
nuget.exe update --self
In the Jenkins job calling rebuild against MSBUILD won't successfully restore the nuget packages
Add a Windows Batch step after the MSBUILD Clean and before the MSBUILD Rebuild like so:
nuget restore <your_solution_file>.sln
Path to solution file is workspace relative.
This will create the packages directory as you would expect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With