Not able to download all nuget package using solution specific nuget.config

Aryan 41 Reputation points
2022-10-13T06:55:23.75+00:00

Hello All,

I'm using "nuget.config" at the same folder level where my visual studio solution file is residing. Getting expected behavior for downloading the nuget package after opening/building the application. Not all nuget packages are getting downloaded from the same nuget package feed, while only two of them are downloaded(below screenshot with red color "checkmark").

249981-nuget-package-error.png

The nuget.config file is as below for reference,

 <?xml version="1.0" encoding="utf-8"?>  
    <configuration>  
      <config>  
        <add key="repositoryPath" value="..\Packages" />  
         <add key="globalPackagesFolder" value="..\Packages" />  
      </config>  
      <packageSources>  
            <clear />  
            <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />  
    		<add key="Microsoft Visual Studio Offline Packages" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\" />  
    		<add key="privateFeed" value="https://xyzpqrs.pkgs.visualstudio.com/_packaging/privatefeed/nuget/v3/index.json" />  
        </packageSources>  
    	<packageRestore>  
    		<add key="enabled" value="true" />  
    		<add key="automatic" value="true" />  
    	</packageRestore>  
    	<activePackageSource>      
    		<add key="All" value="(Aggregate source)" />  
    	</activePackageSource>  
    </configuration>  

Not sure why only those 2 packages are getting downloaded.

Please help me understand why I'm seeing this behavior and how can I download all the nuget packages from this feed or specific package with version number using "nuget.config" file.

Thanks for your help.

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,439 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Aryan 41 Reputation points
    2022-10-14T11:55:51.003+00:00

    I could solve/workaround for the problem using below steps,

    • Open command prompt and run "dotnet nuget locals all --clear" command to clear cached nuget packages
    • Delete "bin" & "obj" folders for solution
    • Create/modify solution specific "nuget.config" file with nuget package location to download
    • Run "Clean Solution" from VS IDE after opening VS solution
    • Refactor/migrate project specific "packages.config" file to "PackageReference"