warning MA002: Starting with .NET 8, setting <UseMaui>true</UseMaui> does not automatically include NuGet package references in your project.

Kim Strasser 1,321 Reputation points
2023-12-03T18:15:03.26+00:00

I get the following warnings in my iOS project. What should I change in my project?

/usr/local/share/dotnet/packs/Microsoft.Maui.Sdk/8.0.0-rc.2.9511/Sdk/BundledVersions.targets(80,5) : warning MA002: Starting with .NET 8, setting <UseMaui>true</UseMaui> does not automatically include NuGet package references in your project. Update your project by including this item: <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.0-rc.2.9511" />. You can skip this warning by setting <SkipValidateMauiImplicitPackageReferences>true</SkipValidateMauiImplicitPackageReferences> in your project file.

/usr/local/share/dotnet/packs/Microsoft.Maui.Sdk/8.0.0-rc.2.9511/Sdk/BundledVersions.targets(100,5) : warning MA002: Starting with .NET 8, setting <UseMauiEssentials>true</UseMauiEssentials> does not automatically include NuGet package references in your project. Update your project by including this item: <PackageReference Include="Microsoft.Maui.Essentials" Version="8.0.0-rc.2.9511" />. You can skip this warning by setting <SkipValidateMauiImplicitPackageReferences>true</SkipValidateMauiImplicitPackageReferences> in your project file.

I use Visual Studio for Mac 17.6.7 (build 417).

My .csproj file:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net8.0-ios</TargetFramework>
    <OutputType>Exe</OutputType>
    <UseMaui>true</UseMaui>
    <UseMauiEssentials>true</UseMauiEssentials>
    <SupportedOSPlatformVersion>15.0</SupportedOSPlatformVersion>
    <CodesignKey>iPhone Developer</CodesignKey>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <CreatePackage>false</CreatePackage>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <CreatePackage>false</CreatePackage>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.1.303" />
    <PackageReference Include="MonoGame.Framework.iOS" Version="3.8.1.303" />
  </ItemGroup>
  <Target Name="RestoreDotnetTools" BeforeTargets="Restore">
    <Message Text="Restoring dotnet tools" Importance="High" />
    <Exec Command="dotnet tool restore" />
  </Target>
</Project>

Bildschirmfoto 2023-12-03 um 18.49.22

Bildschirmfoto 2023-12-03 um 19.08.17

Developer technologies | .NET | .NET MAUI
Developer technologies | Visual Studio | Other
Developer technologies | C#
{count} votes

Accepted answer
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 36,436 Reputation points Microsoft External Staff
    2023-12-05T05:50:58.0166667+00:00

    Hello,

    Is it necessary to add the following package references to my csproj file? <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.0-rc.2.9511" /> <PackageReference Include="Microsoft.Maui.Essentials" Version="8.0.0-rc.2.9511" />.

    Yes, you can remove the references. These references are about Controls and Essential, which are both part of MAUI, you don't have to reference them again.

    Also, I noticed that you created the MAUI project via MonoGame iOS template, and you are using VS for Mac. Since MonoGame is a third-party tool, it's suggested that you create a new issue at their GitHub Repo for further help.

    (By searching for the issues at their GitHub Repo, it looks like they have already removed the VS for Mac templates, and I cannot reproduce your issue)

    Best Regards,

    Wenyan Zhang


    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 to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.