在 Visual Studio 2017 中进行开发时,我使用标准 NuGet 包源和我工作的公司的包源的组合。
要访问这些公司包源,我必须连接到我们公司的 VPN。
不幸的是,这意味着我必须始终连接到我们公司的 VPN,无论我正在开发什么,否则 NuGet 会给我这样的:
Exception 'System.AggregateException' thrown when trying to add source 'http://[one of my company's package sources]'. Please verify all your online package sources are available. One or more errors occurred. Unable to load the service index for source http://[one of my company's package sources]. An error occurred while sending the request. The remote name could not be resolved: '[one of my company's package sources]'
如果我尝试使用仅托管在我公司服务器上的软件包,这将是有意义的。但即使我专门将包源下拉列表设置为 nuget.org,我也会收到此错误。
有一个问题需要修复,但它已经使用了两年并且没有任何事件迹象:install fails when a nuget Source is unavailable even when this is not the selected Source #2614
那么,有没有办法以某种方式配置 NuGet 以忽略丢失的包源?
最佳答案
如解释 in this answer ,Visual Studio 2017 的行为是设计使然,但也许您可以使用自定义 nuget.config 作为解决方法(也在该答案中进行了解释)。
关于nuget - 有没有办法配置 NuGet 以忽略不可用的包源?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46151156/