The instructions below aren't tested in all scenarios, and assume familiarity with Visual Studio, NuGet Package Manager, etc. They should be enough to help.

Backup, branch, or otherwise protect your source first!

To revert from PackageReference to packages.config:

  1. Close the solution.

  2. Delete the project's obj and bin folders (which is where the Reference references are stored)

  3. Edit the .csproj file. Remove <RestoreProjectStyle>PackageReference</RestoreProjectStyle>

  4. Cut/Paste all PackageReference elements into a separate text editor, e.g.

    <ItemGroup>
        <PackageReference Include="MSTest.TestAdapter">
          <Version>1.4.0</Version>
        </PackageReference>
        <PackageReference Include="MSTest.TestFramework">
          <Version>1.4.0</Version>
        </PackageReference>
        <PackageReference Include="Selenium.WebDriver">
          <Version>3.141.0</Version>
        </PackageReference>
        <PackageReference Include="Selenium.WebDriver.ChromeDriver">
          <Version>2.44.0</Version>
        </PackageReference>
    </ItemGroup>
    
  5. Save and close the .csproj file.

  6. Open Visual Studio (but not the solution).

  7. Change the VS default package management format to Packages.config
    OR
    Check Allow format selection on first package
    OR
    Add a packages.config file to the project folder with this text:

    <?xml version="1.0" encoding="utf-8"?>
    <packages>
        <package id="MSTest.TestFramework" version="1.4.0" />
    </packages>
    

    Note: If you don't enable using packages.config, you must manually add at least one of the packages to the xml.

    Note: It's optional, but recommended, to add the targetFramework element with the correct moniker for the project's framework.

  8. Open the solution.

  9. If you manually created a packages.config file, restore missing NuGet packages.

  10. If needed, install remaining NuGet packages using package manager.

  11. Build and test.