我们正在使用改进的 自动包恢复 进程来恢复丢失的 NuGet 包。
在构建时,恢复对话框弹出并从软件包源下载,这是正确的:
Error 10 NuGet Package restore failed for project MyProject: System.InvalidOperationException: Unable to find version '6.0.1' of package 'Newtonsoft.Json'.
at NuGet.PackageHelper.ResolvePackage(IPackageRepository repository, String packageId, SemanticVersion version)
at NuGet.VsEvents.PackageRestorer.RestorePackage(PackageReference package)
at NuGet.VsEvents.PackageRestorer.RestorePackages(String packageReferenceFileFullPath, IFileSystem fileSystem)
at NuGet.VsEvents.PackageRestorer.PackageRestore(ProjectPackageReferenceFile projectPackageReferenceFile).
这可能是因为我有多个软件包源吗?
.nuget/NuGet.config
文件:<configuration>
<packageSources>
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
<add key="private" value="http://privatePackageSource.com/nuget" />
</packageSources>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
</configuration>
我们正在使用Visual Studio 2013和NuGet 2.8.5。
编辑:
使用Fiddler,我确认NuGet确实在错误的源中搜索软件包。它正在从我的私有存储库请求以下软件包。
我还阅读了这篇文章并将
activePackageSource
部分添加到NuGet.config
文件中:<configuration>
<packageSources>
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
<add key="private" value="http://privatePackageSource.com/nuget" />
</packageSources>
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
</configuration>
但它并没有解决问题。