Background
我正在对绿地项目的建设管道进行故障排除.之前一切都正常工作,最近我添加了一个来自同一内部Artifacts Feed的nuget包.为了确保找到所有nuget源代码[或者这就是希望],我使用了nuget. connect文件:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
<add key="my-feed" value="https://pkgs.dev.azure.com/my-feed/_packaging/my-feed/nuget/v3/index.json" />
</packageSources>
</configuration>
它用于dotnet恢复,如下所示:
- task: DotNetCoreCLI@2
inputs:
command: 'restore'
projects: '**/*.csproj'
feedsToUse: 'config'
nugetConfigPath: './nuget.config'
verbosityRestore: 'Normal'
这不会出现任何故障.
The issue I am running into
下一步是运行我的单元测试,它是这样设置的(我还没有碰过它):
- task: DotNetCoreCLI@2
displayName: 'Run Tests'
inputs:
command: 'test'
projects: '**/*.tests*/*.csproj'
arguments: '--configuration $(buildConfiguration) --collect:"XPlat Code Coverage"'
publishTestResults: true
运行日志(log)时显示以下内容:
C:\Windows\system32\chcp.com 65001
Active code page: 65001
Info: .NET Core SDK/runtime 2.2 and 3.0 are now End of Life(EOL) and have been removed from all hosted agents. If you're using these SDK/runtimes on hosted agents, kindly upgrade to newer versions which are not EOL, or else use UseDotNet task to install the required version.
"C:\Program Files\dotnet\dotnet.exe" test D:\a\1\s\MyProject.Tests\MyProject.Tests.csproj --logger trx --results-directory D:\a\_temp --configuration Release "--collect:XPlat Code Coverage"
Determining projects to restore...
Restored D:\a\1\s\MyProject.Domain\MyProject.Domain.csproj (in 80 ms).
D:\a\1\s\MyProject.Contracts\MyProject.Contracts.csproj : error NU1301: Unable to load the service index for source https://pkgs.dev.azure.com/my-feed-mes/_packaging/my-feed-mes/nuget/v3/index.json. [D:\a\1\s\MyProject.Tests\MyProject.Tests.csproj]
D:\a\1\s\MyProject.Tests\MyProject.Tests.csproj : error NU1301: Unable to load the service index for source https://pkgs.dev.azure.com/my-feed-mes/_packaging/my-feed-mes/nuget/v3/index.json.
Failed to restore D:\a\1\s\MyProject.Contracts\MyProject.Contracts.csproj (in 7.73 sec).
Failed to restore D:\a\1\s\MyProject.Tests\MyProject.Tests.csproj (in 7.83 sec).
D:\a\1\s\MyProject.Tests\MyProject.Tests.csproj : error NU1301: Unable to load the service index for source https://pkgs.dev.azure.com/my-feed/_packaging/my-feed/nuget/v3/index.json.
D:\a\1\s\MyProject.Tests\MyProject.Tests.csproj : error NU1301: Unable to load the service index for source https://pkgs.dev.azure.com/my-feed/_packaging/my-feed/nuget/v3/index.json.
D:\a\1\s\MyProject.Tests\MyProject.Tests.csproj : error NU1301: Unable to load the service index for source https://pkgs.dev.azure.com/my-feed/_packaging/my-feed/nuget/v3/index.json.
最终它继续运行,我不得不取消它(或者我猜它会在某个时候停止,但我不能等那么久).
My question
可能导致此错误NU 1301:无法加载服务索引 源错误以及如何解决它?
除了添加内部nuget包(并使用nuget. connect来确定服务器上的源代码正确)之外,没有任何更改.