We have a full-featured .net WPF application .net, which we have moved from .net 4.6.2 to 4.7.1 along with changing the PackageReference in the csproj file instead of packages.config.
Building on development machines seems to be fine, and the packages load and recover, but when we build on our Windows Server 2012 build server with Jenkins , the nuget packages do not seem to be restored correctly.
We use MSBuild v15.5 with the last "msbuild / restore" command to restore packages during build. Note: Using the previous method call "NuGet recovery" does the job, but we need to be able to use MSBuild / restoration at the moment .
It seems that the package recovery process looks at the correct NuGet servers and passes the recovery without errors (this is a test solution compiled in Jenkins to identify the problem):
Restore:
Restoring packages for c:\Jenkins\workspace\Test\ConsoleApp1\ConsoleApp1.csproj...
Committing restore...
Generating MSBuild file c:\Jenkins\workspace\Test\ConsoleApp1\obj\ConsoleApp1.csproj.nuget.g.props.
Generating MSBuild file c:\Jenkins\workspace\Test\ConsoleApp1\obj\ConsoleApp1.csproj.nuget.g.targets.
Writing lock file to disk. Path: c:\Jenkins\workspace\Test\ConsoleApp1\obj\project.assets.json
Restore completed in 577.05 ms for c:\Jenkins\workspace\Test\ConsoleApp1\ConsoleApp1.csproj.
NuGet Config files used:
c:\Jenkins\workspace\Test\NuGet.Config
C:\Windows\system32\config\systemprofile\AppData\Roaming\NuGet\NuGet.Config
Feeds used:
http://devbuild/NuGetHost/nuget
https://api.nuget.org/v3/index.json
Done Building Project "c:\Jenkins\workspace\Test\ConsoleApp1.sln" (Restore target(s)).
But when msbuild arrives to compile the code, we get the following errors, which look as if NuGet was not loaded:
CSC : error CS0006: Metadata file 'C:\Windows\system32\config\systemprofile\.nuget\packages\log4net\2.0.8\lib\net45-full\log4net.dll'
could not be found [c:\Jenkins\workspace\Test\ConsoleApp1\ConsoleApp1.csproj]
Any ideas why nuget packages are not being restored?
source