【发布时间】:2023-03-03 14:55:01
【问题描述】:
我正在开发一个在 Windows 自托管代理上运行的 Azure 管道。 我们配置了一个带有上游的 Artefact 提要以连接到 Nuget。 由于我们位于防火墙后面,这似乎是连接到 Nuget 的唯一方法。
我的管道正在使用这个 nuget.config 文件:
<packageSources>
<clear />
<add key="FeedName" value="https://***.pkgs.visualstudio.com/***/_packaging/FeedName/nuget/v3/index.json" />
</packageSources>
还有这个 YAML:
- task: NuGetAuthenticate@0
- task: CmdLine@2
inputs:
script: '"C:\dotnet\dotnet.exe" publish ${{ parameters.solutionToPublishPath }} -c ${{ parameters.buildConfiguration }} -o $(Build.BinariesDirectory)'
nuget.config 文件破坏了 TeamCity 中以前的管道! 为了在我处理新的同时保持旧的运行,我正在寻找一种将信息从 nuget.config 文件移动到脚本的方法。
有可能吗?
我试过这个:
- task: CmdLine@2
inputs:
script: '"C:\dotnet\dotnet.exe" add "src/project/project.API.csproj" package FeedName -s https://***.pkgs.visualstudio.com/***/_packaging/FeedName/nuget/v3/index.json'
我收到这条消息,这表明它试图直接访问 Nuget 但失败了,这就是我们使用提要的原因。
error: Unable to load the service index for source https://api.nuget.org/v3/index.json.
error: Response status code does not indicate success: 302 (Moved Temporarily).
感谢您的帮助
【问题讨论】:
-
您能否详细说明“nuget.config 文件破坏了 TeamCity 中以前的管道”?您的意思是 nuget.config 设置会影响其他构建吗?
-
谢谢,我不是在 TeamCity 工作的人,但似乎当 nuget 文件中的 FeedName 转到 Azure 提要时,不允许访问 URL,他们永远无法成功TeamCity 更新了 nuget 包,因为这里的安全性非常严格,当时他们决定将 nuget 包复制到本地。将文件重命名为“___nuget.config”修复了 TeamCity 并破坏了 Azure,在我们搬出 TeamCity 之前,我将不得不在不同的分支上工作。
-
您的意思是您的问题有解决方案吗?如果是这种情况,您可以添加回复和Accept it as an Answer,这可能对阅读此主题的其他社区成员有所帮助。
标签: nuget azure-pipelines-build-task azure-pipelines-yaml