I am trying to setup automated nuget package restoration on a vs build or command line build.
When following the specified Microsoft article:
https://docs.microsoft.com/en-us/nuget/consume-packages/package-restore#migrate-to-automatic-package-restore-visual-studio
I am unable to get Visual Studio 2019 or the following commands (nuget restore mysolution.sln, msbuild -t:restore, msbuild -restore) to read from a packages.config file in each of my projects
I have tried the following:
-
removing any references to PackageReference in each of the project files
-
deleting the bin and obj folders in each project
-
adding a local nuget.config with the following:
-
deleting the local packages folder
-
deleting the global packages folder
-
running the following command: nuget locals all -clear
-
Updated Visual Studio -> Tools -> Options -> NuGet Package Manager and set "Allow Nuget to download missing packages" and "Automatically check for missing packages during build in Visual" and set the Default Package management format to "Packages.config"
-
Restarting Visual Studio a few times.
When I run the nuget restore command for my solution it attempts to restore from packagereference inside each of the project files but since I do not have any it does nothing but still creates the corresponding nuget.g.props and project.assets.json files. I cannot use packagereferences inside of project files since this is not portable to other projects.
I require the ability to use packages.config file with one of the build commands.
I am stumped as to why this is not working
Source: Visual Studio Questions