Search code examples
nugetvisual-studio-2017packages.config

Switch back to packages.config


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.


Solution

  • 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.