Xamarin Forms Project packages cleanup

dinon 1 Reputation point

I have an old project started with Forms 2.x.
During the time I can see that number of packages especially for Android grew significantly especially as google APIs were used too.
is there any recommendation how to clean up this as they may be 5 - 8 real nuget added,
but I can see now almost 200 packages with system.reflection*, system,.runtime*, xamarin.android.support*, xamarin.androidx*, xamarin.googleplayservices* packages listed.


A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,298 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 69,311 Reputation points Microsoft Vendor


    Welcome to our Microsoft Q&A platform!

    First of all, You can execute the following steps in xamarin.android.

    1. Right click on your project, select Unload Project.
    2. Select the unloaded project, you'll see a xml file opened.
    3. Look for <ItemGroup> which holds the list of references.

    You can see all of assemblies references here, then reload this xamarin.android project, check nuget packages one by one, open the nuget package manager, check these nuget packages if have other dependent packages, Please notice: you cannot remove these assemblies references because they have dependencies each others. when you deploy your app to production then these unused assemblies automatically remove by Linker.

    Best Regards,

    Leon Lu

    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.