Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuget package restore not respecting my repository path configuration?

Tags:

nuget

I have the following setup in my solution's .nuget/Nuget.Config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <solution>
    <add key="disableSourceControlIntegration" value="true" />
  </solution>
  <config>
    <add key="repositoryPath" value="C:\Xos\packages\" />
  </config>
</configuration>

The point of this is to try and make Nuget package restore manageable, and share packages across our many solutions. I then went into my current solution's packages directory and deleted all the packages (so they would instead restore them to C:\Xos\packages). I then closed VS 2012 and reloaded the solution and rebuilt.

However, all my packages are being restored in my solution's packages directory, NOT the directory specified in repositoryPath configuration.

What am I doing wrong?

like image 458
KallDrexx Avatar asked Oct 21 '22 17:10

KallDrexx


2 Answers

I had the same issue with VS2015 RC. One of two things suddenly made it work:

(1) I checked-out the project file from source control, and completely closed Visual Studio (not just the solution).

(2) I edited the csproj file and noticed that the entry for packages.config had a <SubType>Designer</SubType> inner tag, which I removed.

I suspect it was the close-down of Visual Studio...

like image 151
Riegardt Steyn Avatar answered Oct 25 '22 18:10

Riegardt Steyn


This appears to be a bug and is fixed in 2.3 (which doesn't appear to be released yet).

Until then I modified my Nuget.Targets as described in that bug and using that for now.

like image 27
KallDrexx Avatar answered Oct 25 '22 18:10

KallDrexx