Uninstalling NuGet packages in a .NET MAUI project

Gopi Matham 20 Reputation points
2024-02-19T11:54:56.0333333+00:00

When I created a .NET MAUI project, some NuGet packages were installed by default. These packages are causing errors when I try to reference another project in this project. However, these packages are not listed in the project file, and I am unable to uninstall or update them. The attached image shows the NuGet Packages. Can anyone please help me with the process to uninstall or update these packages? Your help will be greatly appreciated. Thank you.

Screenshot 2024-02-19 162607

These Packages in net7.0-ios are installed by default when creating the project. These are giving the errors. The error is

Severity Code Description Project File Line Suppression State Details Error NU1605 Warning As Error: Detected package downgrade: Microsoft.Extensions.DependencyInjection from 8.0.0 to 7.0.0. Reference the package directly from the project to select a different version.

The android packages also gave me the error

Severity Code Description Project File Line Suppression State Details Error NU1605 Warning As Error: Detected package downgrade: Xamarin.AndroidX.Browser from 1.5.0.3 to 1.4.0.3. Reference the package directly from the project to select a different version.

All the above packages are not able update or uninstall, because the Update or Uninstall buttons are disabled.

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,231 questions
{count} votes

Accepted answer
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 39,391 Reputation points Microsoft Vendor
    2024-02-21T07:36:07.6033333+00:00

    Hello,

    These above packages are installed by default and i'm not able to update or delete them. Only Microsoft.Extensions.Logging.Debug can be deleted from these packages, and the other items are required for MAUI to run. You can open the project's .csproj file and delete the following.

    <ItemGroup>
          <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
    </ItemGroup>
    

    For updates, you could do it in the project file. Please refer to the code below.

    <ItemGroup>
          <PackageReference Include="Nuget Package Name" Version="Version Number" />
    </ItemGroup>
    

    Best Regards, Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our [documentation][1] to enable e-mail notifications if you want to receive the related email notification for this thread. [1]: https://docs.microsoft.com/en-us/answers/articles/67444/email-notifications.html

    0 comments No comments

0 additional answers

Sort by: Most helpful