gpt4 book ai didi

c# - 为什么我的 repositoryPath 在 Azure DevOps/TFS 中被忽略?

转载 作者:行者123 更新时间:2023-12-04 10:33:20 24 4
gpt4 key购买 nike

首先,我有一个 NuGet.Config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="repositoryPath" value=".\ExternalReferences\Packages" />
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
</config>
</configuration>

在我的根 dev分支。它的工作是,我 dev 中的每个项目分支将包恢复到 \dev\ExternalReferences\Packages ,在本地工作正常。

我试图通过 TFS(VisualStudio Team Services/DevOps)为我的 CI-Build 引入 Azure Pipelines。

但是,TFS 正在将软件包还原到错误的文件夹 \dev\packages (其中 \devD:\a\9\s\ )而不是 \dev\ExternalReferences\Packages .
Acquired lock for the installation of Newtonsoft.Json 12.0.3
Installing Newtonsoft.Json 12.0.3.
Adding package 'Microsoft.Extensions.Logging.Abstractions.2.2.0' to folder 'D:\a\9\s\packages'

这会在稍后破坏构建(期望 ExternalReferences\Packages ):
PrepareForBuild:
Creating directory "bin\Release\".
Creating directory "obj\Release\".
ResolveAssemblyReferences:
Primary reference "Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL".
##[warning]C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2110,5): Warning MSB3245: Could not resolve this reference. Could not locate the assembly "Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2110,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [D:\a\9\s\Conwell.WebServices.Google\Conwell.WebServices.Google.csproj]

知道如何让 NuGet 恢复到正确的目录吗?

我刚刚为项目类型 Asp.NET 创建了一个标准管道

Nuget

最佳答案

Why is my repositoryPath ignored in Azure DevOps / TFS?



由于 nuget 还原任务将包还原到错误的文件夹 \dev\package s,好像是设置 repositoryPathNuGet.Config被忽略。

要解决此问题,您可以尝试指定 nuget.config当您设置 nuget 还原任务以确保您已使用 NuGet.Config :

enter image description here

然后我的 nuget.config好像:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="AzureDevOpsFeed" value="https://pkgs.dev.azure.com/xxxn/_packaging/xxx/nuget/v3/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>

<config>
<add key="repositoryPath" value=".\ExternalReferences\Packages" />
</config>

</configuration>

然后,作为测试结果,我可以在文件夹 ExternalReferences\Packages 中获取包。 :

enter image description here

希望这可以帮助。

关于c# - 为什么我的 repositoryPath 在 Azure DevOps/TFS 中被忽略?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60309858/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com