Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microsoft NuGet targets Error while building Project from Teamcity

I attempted in building the .NET Standard Library Project using .NET Framework 4.6.1 from Command prompt using MSBuild Commmand. I manage to succeed building the project from command prompt.

I tried the same MSBuild command to build the project from Teamcity Command line build step, but ended up getting the following error:

    C:\Program Files (x86)\MSBuild\Microsoft\NuGet\Microsoft.NuGet.targets(140,5): error : The package Microsoft.NETCore.Portable.Compatibility 
   with version 1.0.1 could not be found in C:\Windows\system32\config\systemprofile\.nuget\packages\. Run a NuGet package restore to download the package.

I tried Restoring nuget.exe restore mysolution.sln but noting works.

Please help me to compile the solution from Teamcity command line step. Its strange to get compiled from command prompt but not from teamcity command line.

like image 628
Priyadharsini Avatar asked Jun 06 '26 12:06

Priyadharsini


1 Answers

Looks like there is a known issue in NuGet when restoring packages using the LocalSystem account wherein the packages cannot be accessed under the C:\Windows\system32\config\systemprofile\.nuget\packages folder, even though account permissions should allow it (see this GH issue). The current recommended workaround is to use the NUGET_PACKAGES environment variable to specify another location for the packages (e.g. C:\NuGet\packages).

like image 76
Chris Staley Avatar answered Jun 10 '26 20:06

Chris Staley



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!