面对点网核心服务在ADO中的构建管道中遇到一个奇怪的问题。
我正在尝试为nuget.config文件中引用的软件包设置路径。下面是nuget.config文件。
const constantMock = window.fetch;
window.fetch = function() {
// Get the parameter in arguments
// Intercept the parameter here
console.log(arguments);
return constantMock.apply(this, arguments)
}
在添加以下行后得到401未经授权。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="repositorypath" value="..\..\Packages" />
<!--Affects projects using PackageReference only-->
<add key="globalPackagesFolder" value="..\..\Packages" />
<add key="dependencyversion" value="HighestMinor" />
</config>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
<packageRestore>
<!-- Allow NuGet to download missing packages -->
<add key="enabled" value="True" />
<!-- Automatically check for missing packages during build in Visual Studio -->
<add key="automatic" value="True" />
</packageRestore>
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
<packageSources>
<add key="NuGet Server" value="my private feed" />
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
</packageSources>
<disabledPackageSources />
</configuration>
例外
<add key="globalPackagesFolder" value="..\..\Packages" />
下面是构建管道中的任务
Retrying 'FindPackagesByIdAsync' for source 'myfeed/nuget/v3/flat2/microsoft.extensions.dependencyinjection/index.json'.
Response status code does not indicate success: 401 (Unauthorized).
Restore failed in 8.09 sec for /home/vsts/work/1/s/Service/Test/myproject.Tests/myproject.Tests.csproj.
答案 0 :(得分:0)
在nuget.config中提供globalPackagesFolder时,.net核心服务的构建管道失败,并显示错误401(未经授权)
根据错误消息:
nuget.config
我们可以知道它正在尝试访问您的私有nuget提要,并收到此401(未经授权)错误。看来您没有在nuget.config
文件中提供认证信息。
要解决此问题,请尝试在您的 <packageSourceCredentials>
<NuGet Server>
<add key="Username" value="xxxxx" />
<add key="ClearTextPassword" value="Password/PAT" />
</NuGet Server>
</packageSourceCredentials>
中添加证书信息,如下所示:
Scanner
检查this线程以了解更多详细信息。
希望这会有所帮助。