none
Installing Nuget packages at project level folder RRS feed

  • Question

  • Hi, I have a .NET solution with few projects in VS2015. Each of these projects consume 1 or more Nuget packages. To each project, I have added a Nuget.config file which has this setting:

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

    Intent is to install packages in project level packages folder. This is a short term solution which we need to adopt till we are in our current version control system. Once we migrate to TFVC in couple of quarters, this limitation of installing packages at project level packages folder will go away. But as of now due to certain design constraints, we need to store packages at the project level. But when I install packages through Visual Studio package manager, they are still getting installed in solution level packages folder. These are project level packages as they have files in lib directories. So whenever I install them, packages.config file at the project level gets updated accordingly but the location is still at solution level.VS Package manager doesn't seem to read project level nuget.config at have destination folder at project level. Pls help.

    Thanks

    Sandeep

    Thursday, March 2, 2017 7:23 PM

All replies

  • Hi Sunny1704,

    This forum discusses and asks questions about extending and integrating with Visual Studio, Since your issue is more related visual studio general, we'll move it to vs general forum for suitable support.

    Thanks for your understanding and cooperation.

    Best regards,

    Cole Wu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, March 3, 2017 3:11 AM
  • Hi Sunny1704,

    NuGet assumes packages default belong at the "solution" level, we could not configure each project has its own packages folder.

     

    This is for more convenient and safe consideration. For example, when we have multiple projects in one solution, if we use Nuget packages at project level folder, we might install many same packages for each project and also need to do duplicate update restore operation for each project. This will take a lot of unnecessary time and resources. We recommend you use the NuGet packages at the "solution" level.  So the location of packages is still at defualt solution level even if you set Nuget.config file for project level folder. NuGet.config at the "solution" level allows multiple projects in one solution to use the same packages in source control.

     

    Besides, would you mind sharing us more detail of that design constraints, which need use Nuget packages at project level folder? If that is reasonable, we are willing to help you submit a user voice to NuGet team.


    MSDN Community Support<br/> Please remember to click &quot;Mark as Answer&quot; the responses that resolved your issue, and to click &quot;Unmark as Answer&quot; if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact <a href="mailto:MSDNFSF@microsoft.com">MSDNFSF@microsoft.com</a>.

    Friday, March 3, 2017 6:36 AM