3

I'm making a MAUI Android app and some time ago I updated the target framework to .NET8. Since then, I'm getting this warning about Microsoft.Maui.Controls not being automatically included.

Warning MA002 Starting with .NET 8, setting true does not automatically include NuGet package references in your project. Update your project by including this item: . You can skip this warning by setting true in your project file. NLTerminal C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\8.0.7\Sdk\BundledVersions.targets 85

I updated the package to 8.0.21 and then manually added a PackageReference in the .csproj file:

<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.21" />

I then saw, VS automatically also added an Update reference:

<PackageReference Update="Microsoft.Maui.Controls" Version="8.0.21" />

Is there any way to resolve this warning except suppressing it as it suggests?

<SkipValidateMauiImplicitPackageReferences>true</SkipValidateMauiImplicitPackageReferences>

I figured out the warning is coming from the BundledVersions.targets file where it seems to be hard-coded to be permanently displayed until it's erased from there. Is that the right solution though?

Or is there a way to fetch a newer version of Microsoft.Maui.Sdk and hope that will resolve the warning?

1 Answer 1

2

This may relate to a known issue on GitHub, warning MA002 is raised claiming that packages are not automatically included. From the comment, it seems the messaging text is misleading here, and the issue is added to the backlog. You may track this issue.

Also, these Microsoft.Maui.Controls are about Controls of MAUI, which IS A part of MAUI. So you don't have to reference them again.

Hope it helps!

4
  • I still don't know if I should do something about it.
    – Val
    Commented May 1, 2024 at 14:44
  • Can your MAUI App be built successfully?
    – Felix Shen
    Commented May 2, 2024 at 6:41
  • Yes, it builds fine. But I still wanted to resolve the warning correctly.
    – Val
    Commented May 3, 2024 at 6:33
  • 1
    I think right now you may ignore it as it seems no effect on your project currently. You may also keep an eye on this issue and get the latest updates.
    – Felix Shen
    Commented May 6, 2024 at 2:19

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.