Search code examples
c#visual-studionugetmauidowngrade

How to downgrade Nuget packages in Visual Studio?


I have recently updated the Nugget packages in my .NET MAUI project (.NET 8) to preview 9.x which had fatal consequences. How do I downgrade them back to the latest stable version? Is upgrading .NET 8 to .NET 9 possible?


Solution

  • To upgrade or downgrade a package using visual studio:

    1. In the solution explorer right click on the project that has the NuGet package in it
    2. Select the manage NuGet Packages menu item
    3. This will open a tab titled NuGet: {YourProjectName}
    4. Make sure that the installed tab is selected to browse your current installed NuGet packages for that project
    5. Click on the package that you want to change the version of
    6. On the right side of the open panel you will see two drop downs, one for the currently installed version and one for the version we want to install
    7. Select the version that you want to install. In Visual Studio 2022 there may be a pinned item at the top that says Latest Stable. This is usually a good version to start with when rolling back
    8. Click the update button and then accept on the popup that comes up

    As long as there are no errors installing the package you will now have downgraded the selected package. Rinse and repeat this for any other packages that are giving you issues.