'NuGet packages are partially downloaded to the wrong directory
First off, I have the following setup:
- MS Visual Studio 2019
- .Net 5 SDK
dotnet --version: 5.0.405dotnet nuget --version: 5.11.1.5
This is regarding an Azure Functions project with the following project structure:
| MyProject.sln
| NuGet.Config
| Packages
| - Contains (at least should) all downloaded NuGet Packages
| Sources
| - Contains all subprojects
The NuGet.Config looks like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="globalPackagesFolder" value="Packages" />
</config>
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="Microsoft Visual Studio Offline Packages" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\" />
</packageSources>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
<bindingRedirects>
<add key="skip" value="False" />
</bindingRedirects>
<packageManagement>
<add key="format" value="1" /> <!-- Using PackageReference -->
<add key="disabled" value="False" />
</packageManagement>
</configuration>
The default directory for storing the NuGet packages is %userprofile%\.nuget\packages.
When I don't provide any NuGet.Config file, any NuGet package is placed there.
Using the above config ensures, that the packages are placed in the \Packages directory in project folder -> That's fine!
BUT: When I now open Visual Studio 2019 to things happen:
- RESTORE: Downloads 171 Packages and places them where they should be placed
- REBUILD PROJECT: Downloads another 137 Packages and places them in default nuget directory
The result of the second step is NOT what I am expecting.
- Am I doing something wrong within the
NuGet.Configfile? - Is this kind of a bug?
- Or is that the expected behaviour and I am wrong with my expectations?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
