Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build project - Nuget Error

The error occurs only on one machine.

Attempts

Wrong paths

I thought the path of any source may be wrong, so I opened the NuGet.Config to check and the 3 paths are correct and there!

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageRestore>
    <add key="enabled" value="True" />
  </packageRestore>
  <packageSources>
    <add key="NuGet official package source" value="https://nuget.org/api/v2/" />
    <add key="Nightly ASP.NET Web Stack" value="http://www.myget.org/F/aspnetwebstacknightly/" />
    <add key="Bind Solution" value="W:\Cloud\Dropbox\Bind Defaults\Nuget Repository" />
  </packageSources>
  <disabledPackageSources />
  <activePackageSource>
    <add key="NuGet official package source" value="https://nuget.org/api/v2/" />
  </activePackageSource>
</configuration>

Nuget.exe not exist

Checked on .nuget folder and .exe is in the directory! Checked in Path of windows and there is!

I tried to run the command manually and it run successfully!

nuget install packages.config -source "" -NonInteractive -RequireConsent -solutionDir "W:\C lients\creditoimobiliariobb\sistema\src\CreditoImobiliarioBB\ "

Full error:

Error 1 The system cannot find the path specified. CreditoImobiliarioBB.Domain

Error 2 The command ""W:\Clients\creditoimobiliariobb\sistema\src\CreditoImobiliarioBB.nuget\NuGet.exe" install "W:\Clients\creditoimobiliariobb\sistema\src\CreditoImobiliarioBB\CreditoImobiliarioBB.Model\packages.config" -source "" -NonInteractive -RequireConsent -solutionDir "W:\Clients\creditoimobiliariobb\sistema\src\CreditoImobiliarioBB\ " " exited with code -1. CreditoImobiliarioBB.Domain

Considerations

Only projects that have local packages (Source is key="Bind Solution" value="W:\Cloud\Dropbox\Bind Defaults\Nuget Repository") is that they are in trouble. And recently the location of packages moved to another directory (in this case to W:\Cloud\Dropbox\Bind Defaults\Nuget Repository).

like image 559
ridermansb Avatar asked Mar 13 '26 15:03

ridermansb


1 Answers

I had a similar problem recently, I fixed it by doing this:

  1. Update Visual Studio to the latest version. (Extensions and Updates - Product Updates)
  2. Update Nugget to the latest version. (Extensions and Updates - Visual Studio Gallery)
  3. Clear the Package Cache. (Options - Package Manager)
  4. Rebuild the solution.

Hope it helps.

like image 146
Federico Bergstein Avatar answered Mar 17 '26 03:03

Federico Bergstein



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!