Reputation: 17004
First of all, I have a 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>
In the root of my dev
branch. It's job is, that every project in my dev
branch restores the packages into \dev\ExternalReferences\Packages
, which works fine localy.
Im trying to introduce Azure Pipelines via TFS (VisualStudio Team Services/DevOps) for my CI-Build.
However, TFS is restoring the packages into the wrong folder \dev\packages
(where \dev
is D:\a\9\s\
) instead of \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'
This breaks the build later (Which expects the 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]
Any Idea how to make NuGet to restore to the correct directory?
I just created a standard Pipeline for the project type Asp.NET
Upvotes: 2
Views: 423
Reputation: 76670
Why is my repositoryPath ignored in Azure DevOps / TFS?
Since the nuget restore task restoring the packages into the wrong folder \dev\package
s, it seems the settings repositoryPath
in the NuGet.Config
is ignored.
To resolve this issue, you could try to specify the nuget.config
when you set the nuget restore task to make sure you have use the NuGet.Config
:
Then my nuget.config
looks like:
<?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>
Then, as test result, I could get the package in the folder ExternalReferences\Packages
:
Hope this helps.
Upvotes: 2
Reputation: 17004
As a workaround I configured the directory directly:
Go to pipeline, and edit:
Go to NuGet restore, Advanced and Destination Directory:
I am still open to options, which would respect the NuGet.Config
.
Upvotes: 0