NuGet configuration file for VS2015 solution (NuGet 3.4+)

Well, that may sound like a duplicate question, but this is not the case with my searches.

I was looking for a suitable way to configure a specific package source (url) in my solution, which automatically generates everything (.nuget files and / or nuget configuration files), infringed on the solution path.

I do not want to use APPDATA nor MACHINE.

I want to use only the solution catalog for everything, so when another user retrieves the solution from the repository, he gets everything correctly installed (including links to nuget in the package folder).

I read the NuGet documentation and it seems that the way this can be achieved is not easy, due to the different versions of NuGet, etc.

Can anyone give minimalistic guidance to achieve this? Thanks for your help in advance!


Updated question:

I notice that with NuGet version 3.4+ I no longer need the .nuget folder !

My question / problem is to configure the package source URL with the solution, not with machine / appdata strong>, because I use the source package URL containing the corporate library feed! thank:)

Details:

I noticed that the source URL is stored in the NuGet.config file in% APPDATA% \ NuGet \ NuGet.Config .

How can I properly configure this by solution ? why is it easily supported in corporate business?

(I mean, I do not need each user to configure the source on their machine)


From the NuGet documentation:

"A NuGet.Config, ,, .nuget . NuGet 3.3 . NuGet 3.4 ."

, ? !

+4
3

, ( NuGet 3.4.4):

  • / .

  • , nuget , VS2015 > NuGet >

enter image description here

  1. , , .

enter image description here

  1. (AppData) NuGet : % APPDATA%\NuGet\NuGet.Config

enter image description here

  1. , NuGet.Config , !

enter image description here

, , AppData! ( , )


. NuGet.Config AppData, VS AppData !

2: Git /TFS , , !

+6

, nuget , Visual Studio 2015 3 NuGet Package Manager 3.5, nuget nuget, . enter image description here

, , , , .

, , , .

nuget APPDATA MACHINE .

+1

For VS2017,

  • Create folder MyLocalPackages

  • Put the NuGet package files in it.

  • Create NuGet.configaside from the sln file

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <packageSources>
        <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
        <add key="Local Packages" value=".\MyLocalPackages" />
      </packageSources>
    </configuration>
    

Works for VS2017 15.5.5.

Result: enter image description here

0
source

Source: https://habr.com/ru/post/1661603/


All Articles