How do you add a NuGet package to a MAUI project?
Short answer
Add it like any .NET package (dotnet add package or the IDE), ensuring the package supports the MAUI target frameworks. Cross-platform packages 'just work'; platform-specific ones may only apply to certain TFMs. Check for MAUI compatibility before adopting a library.
Advertisement
AModel answer
Add it like any .NET package (dotnet add package or the IDE), ensuring the package supports the MAUI target frameworks. Cross-platform packages 'just work'; platform-specific ones may only apply to certain TFMs. Check for MAUI compatibility before adopting a library.
dotnet add package CommunityToolkit.MauiReal-world example
A team adds CommunityToolkit.Maui and initializes it with UseMauiCommunityToolkit() to gain popups and behaviors.
Likely follow-ups
- How do you know a package supports MAUI? | Do all packages target every platform?
Related topics