Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Switch back to packages.config

Tags:

Is it possible to switch back to packages.config scheme of things? I moved to PackageReference scheme when I created the project, but for some reasons need to move to old way of things now.

I have tried Package Manager Console commands like restore with Update and Reinstall options. They do not generate packages.config anymore. I also switched Tools > Options > NuGet Package Manager to packages.config. No good.

like image 344
dotNET Avatar asked Aug 30 '17 14:08

dotNET


People also ask

Where is package config?

If used, packages. config must be located in a project root. It's automatically created when the first NuGet operation is run, but can also be created manually before running any commands such as nuget restore .

What is package config Targetframework?

packages. config: The targetframework attribute of a dependency specifies the variant of a package to install.


1 Answers

You'll need to:

  1. Add an "empty" packages.config file to the project (that is, xml as in the example but without individual <package> elements)
  2. Unload the project or close vs and open the csproj file in a text editor.
  3. Remove all PackageReference elements out of the project file.
  4. Make sure that <RestoreProjectStyle> is not set in the project file.
  5. Reopen the project in VS.
like image 118
Martin Ullrich Avatar answered Sep 22 '22 00:09

Martin Ullrich