错误只发生在一台机器上。
尝试
错误的路径
我认为任何源的路径可能是错误的,所以我打开NuGet.Config
检查,3个路径都是正确的!
<?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 不存在
检查 .nuget
文件夹,.exe 在目录中!
查看windows的Path,有!
我尝试手动运行命令,它运行成功!
nuget install packages.config -source ""-NonInteractive -RequireConsent -solutionDir "W:\C
lients\creditoimobiliarobb\sistema\src\CreditoImobiliarioBB\"
完整错误:
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
注意事项
只有具有本地包的项目(来源是 key="Bind Solution"value="W:\Cloud\Dropbox\Bind Defaults\Nuget Repository"
)才会有麻烦。最近,包的位置移动到另一个目录(在本例中为 W:\Cloud\Dropbox\Bind Defaults\Nuget Repository
)。
最佳答案
我最近遇到了类似的问题,我通过这样做解决了它:
- 将 Visual Studio 更新到最新版本。 (扩展和更新 - 产品更新)
- 将 Nugget 更新到最新版本。 (扩展和更新 - Visual Studio 库)
- 清除包缓存。 (选项 - 包管理器)
- 重建解决方案。
希望对您有所帮助。
关于nuget - 构建项目 - Nuget 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18209071/