Azure devops Azure DevOps Server dotnet restore无法访问源
我需要将Azure devops Azure DevOps Server dotnet restore无法访问源,azure-devops,Azure Devops,我需要将.NET Core构建管道任务与恢复命令一起使用。目标是恢复解决方案的包引用(*.nupkg)。我有两个资料来源: nuget.org 广告上的私有工件提要(MyFeed) 我的解决方案中的一些项目引用了MyFeed中的包,需要在构建之前在代理上进行恢复 错误 当任务试图从我的私有feed MyFeed下载包时失败了:(不幸的是输出是德语的,所以我把错误消息放进了谷歌翻译,希望一切顺利) 我做了什么? 使用NuGet任务 我试图通过NuGet任务重现这种行为,但是通过这个任务,
.NET Core
构建管道任务与恢复
命令一起使用。目标是恢复解决方案的包引用(*.nupkg
)。我有两个资料来源:
- nuget.org
- 广告上的私有工件提要(MyFeed)
错误 当任务试图从我的私有feed MyFeed下载包时失败了:(不幸的是输出是德语的,所以我把错误消息放进了谷歌翻译,希望一切顺利)
我做了什么? 使用NuGet任务 我试图通过
NuGet
任务重现这种行为,但是通过这个任务,一切都很好。此任务可以访问我的私人源MyFeed。重要提示:NuGet
任务是不可替代的,我们需要使用.NET核心
任务
Windows凭据管理器
我将提要添加到代理上Visual Studio 2019中的包管理器,并输入代理用户的凭据。在我的Windows凭据管理器中添加了2个条目之后
此更改无法解决问题,错误消息是相同的
编辑1:将Auth添加到NuGet.Config 我尝试将Auth添加到我的
numget.Config
。这种方法有很多变量,我尝试列出我尝试的所有种类
NuGet.Config路径
dotnet restore
任务提供了NuGet配置的选项:
%APPDATA%\NuGet\NuGet.Config
关联(但我不确定)NuGet.Config
路径用户名
和域密码
(加密)❌李>
Username
和PAT
(ClearTextPassword)❌李>
Domain\Username
和PAT
(ClearTextPassword)❌李>
Username
和Domain Passwort
(ClearTextPassword)❌李>
Domain\Username
和Domain Passwort
(ClearTextPassword)❌李>
所有运行的NuGet.Config结构
临时NuGet.Config:
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3"/>
<add key="feed-MyFeed" value="https://MyAdsUrl.de/MyCollection/_packaging/MyFeed/nuget/v3/index.json"/></packageSources>
<config>
<add key="http_proxy" value="http://www-cache.MyProxy.de:3000"/>
<add key="https_proxy" value="http://www-cache.MyProxy.de:3000"/>
</config>
<packageSourceCredentials>
<feed-MyFeed><add key="Username" value="VssSessionToken"/><add key="ClearTextPassword" value="QhbGcsadsasadd... VERY LONG KEY-PA"/></feed-MyFeed></packageSourceCredentials>
</configuration>
从我的角度来看,我可以看到tempraryNuget.Config
包含我的自定义代理和我的自定义提要,但不是我的自定义身份验证
这是否意味着dotnet
任务不使用我的自定义numget.Config
?
元信息
- 广告和代理是自托管的
- 版本:17.153.29207.5(AzureDevPS2019.Update1)
- 代理:是的
并确保将persistcredentials设置为true(签出参数)您可以尝试将azure工件源的凭据放入nuget.config文件中 首先,您需要从Azure devops生成一个具有读写打包功能的包 然后,您可以为您的nuget源向azure源提供凭据。请参见以下示例:
<configuration>
<packageSources>
<add key="AzureArtifactFeedName" value="http://dctfs2019:8080/tfs/Collection/_packaging/AzureArtifactFeedName/nuget/v3/index.json" />
</packageSources>
<packageSourceCredentials>
<AzureArtifactFeedName>
<add key="Username" value="any" />
<add key="ClearTextPassword" value="{Personal Access Token}" />
</AzureArtifactFeedName>
</packageSourceCredentials>
</configuration>
然后可以自动推送包
此外,您可以尝试将
添加到包源凭据中,以防止nuget/dotnet尝试通过NTLM/Windows身份验证进行身份验证
Azure DevOps Server dotnet restore无法访问源
要解决此问题,可以使用nuget restore
任务来还原包,并使用带有参数--no restore
的dotnet build
任务:
如果仍要使用dotnet restore
而不是nuget restore
,则可以在Azure devops服务器计算机中执行以下dotnet
命令行:
dotnet nuget add source http://xxxxx/DefaultCollection/_packaging/LeoTestFeed/nuget/v3/index.json -n YourFeedName -u YourUserName -p YourPAT --store-password-in-clear-text
您可以查看文档以了解更多详细信息
然后我们可以成功地使用dotnet还原:
我的测试结果(TFS 2018,因为我的TFS2019服务器因未知原因关闭):
谢谢您的回复!
NuGet Authenticate
任务不是Azure DevOps服务器2019的一部分。有关更多信息,请参阅。嗨,Alina,非常感谢你的回答。我在问题编辑1中添加了一个新部分:将Auth添加到NuGet.Config。如果你能读的话,我会很高兴的。不幸的是,这种方法不适合我。但是我采用了dotnet
还原任务忽略我的NuGet.Config
中的自定义身份验证配置。您能确认吗?dotnet
任务在我使用nuget服务连接时,也将使用临时nuget.config
中的VssSessionToken
。无法阻止dotnet
任务创建临时nuget.config
文件,只能在该临时config.config中进行自定义身份验证,谢谢您的回复。nuget restore
通常也适用于我们。但我们过度服务于一种奇怪的行为,为什么我们不能使用它。在项目文件中,我们使用包引用,如
,以始终从提要获取最新版本的包。我在提要中有一个版本为4.0.0
的包。我必须做一个非常小的更改,所以在4.0.0.1
中添加一个版本计数器nuget restore
任务将此包随机解析为4.0.0
,有时解析为4.0.0.1
(本地缓存已禁用),因此我们失去了对该任务的信任。另一个要求是对构建使用完整的dotnet
工具链。原则上,我们喜欢一体化dotnet
方法。不幸的是,一些小问题(身份验证)阻止了在我们的管道中使用dotnet
。我不应该使用dotnet nuget add源代码吗http://xxxxx/DefaultC
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3"/>
<add key="feed-MyFeed" value="https://MyAdsUrl.de/MyCollection/_packaging/MyFeed/nuget/v3/index.json"/></packageSources>
<config>
<add key="http_proxy" value="http://www-cache.MyProxy.de:3000"/>
<add key="https_proxy" value="http://www-cache.MyProxy.de:3000"/>
</config>
<packageSourceCredentials>
<feed-MyFeed><add key="Username" value="VssSessionToken"/><add key="ClearTextPassword" value="QhbGcsadsasadd... VERY LONG KEY-PA"/></feed-MyFeed></packageSourceCredentials>
</configuration>
<configuration>
<packageSources>
<add key="AzureArtifactFeedName" value="http://dctfs2019:8080/tfs/Collection/_packaging/AzureArtifactFeedName/nuget/v3/index.json" />
</packageSources>
<packageSourceCredentials>
<AzureArtifactFeedName>
<add key="Username" value="any" />
<add key="ClearTextPassword" value="{Personal Access Token}" />
</AzureArtifactFeedName>
</packageSourceCredentials>
</configuration>
sources Add -Name "AzureArtifactFeedName" -Source "http://dctfs2019:8080/tfs/Collection/_packaging/AzureArtifactFeedName/nuget/v3/index.json" -username any -password PersonalAccessToken -ConfigFile path/to/Nuget.config -StorePasswordInClearText
dotnet nuget add source http://xxxxx/DefaultCollection/_packaging/LeoTestFeed/nuget/v3/index.json -n YourFeedName -u YourUserName -p YourPAT --store-password-in-clear-text