先说一个问题
首先记录一个问题,今天在用 Jenkins 构建项目的时候突然出现包源的错误:
/usr/share/dotnet/sdk/2.2.104/NuGet.targets(114,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [/....csproj]
/usr/share/dotnet/sdk/2.2.104/NuGet.targets(114,5): error : The HTTP request to 'GET https://api.nuget.org/v3/index.json' has timed out after 100000ms. [/....csproj]
nuget的包源无法访问(无法ping通),而我在一台服务器上访问https://api.nuget.org/v3/index.json
时则会自动重定向到https://nuget.cdn.azure.cn/v3/index.json
。
但是打包机器执行dotnet restore
却还是无法还原成功,即使指定包源后即dotnet restore -s https://nuget.cdn.azure.cn/v3/index.json
能还原一部分包,部分包依旧无法还原
最后测试发现,包源只是部分地区无法访问,可以尝试切换源/使用Nuget.Config文件试试,当然最快的还是通过科学的方式访问~。
若本地 VS 的包管理器也无法正常使用&#