maui icon indicating copy to clipboard operation
maui copied to clipboard

warning MA002 is raised claiming that packages are not automatically included, yet packages *are* automatically included - leading to making it impossible to add a direct reference to an implicit package through tooling

Open nkolev92 opened this issue 1 year ago • 2 comments

Description

The maui templates raise warnings about packages not being included automatically, yet those exact packages are included automatically.

This behavior means that it is impossible to add a direct reference to an implicit package through tooling, because as far as the tooling is concerned, the package is already added in an imported file.

Steps to Reproduce

D:\Maui216> dotnet --version 8.0.300-preview.24101.10

  1. dotnet new maui
  2. dotnet remove package Microsoft.Maui.Controls.Compatibility
  3. dotnet remove package Microsoft.Maui.Controls
  4. dotnet restore
  5. dotnet list package

Observe that at step 4, a warning is raised:

warning MA002: Starting with .NET 8, setting <UseMaui>true</UseM aui> does not automatically include NuGet package references in your project. Update your project by including this item: <PackageReference Include="Mic rosoft.Maui.Controls" Version="8.0.6" />. You can skip this warning by setting <SkipValidateMauiImplicitPackageReferences>true</SkipValidateMauiImplicitP ackageReferences> in your project file. [D:\Maui216\Maui216.csproj::TargetFramework=net8.0-android]

However, note that the package is still implicitly added.

Link to public reproduction project repository

No response

Version with bug

Unknown/Other

Is this a regression from previous behavior?

No, this is something new

Last version that worked well

Unknown/Other

Affected platforms

iOS, Android, Windows, macOS

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

D:\Maui216> dotnet restore
  Determining projects to restore...
C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\8.0.6\Sdk\BundledVersions.targets(85,5): warning MA002: Starting with .NET 8, setting  <UseMaui>true</UseMaui>  does not automatically include NuGet package re
ferences in your project.  Update your project by including this item:  <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.6" />.  You can skip this warning by setting  <SkipValidateMauiImplicit
PackageReferences>true</SkipValidateMauiImplicitPackageReferences>  in your project file. [D:\Maui216\Maui216.csproj::TargetFramework=net8.0-android]
C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\8.0.6\Sdk\BundledVersions.targets(85,5): warning MA002: Starting with .NET 8, setting  <UseMaui>true</UseMaui>  does not automatically include NuGet package re
ferences in your project.  Update your project by including this item:  <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.6" />.  You can skip this warning by setting  <SkipValidateMauiImplicit
PackageReferences>true</SkipValidateMauiImplicitPackageReferences>  in your project file. [D:\Maui216\Maui216.csproj::TargetFramework=net8.0-ios]
C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\8.0.6\Sdk\BundledVersions.targets(85,5): warning MA002: Starting with .NET 8, setting  <UseMaui>true</UseMaui>  does not automatically include NuGet package re
ferences in your project.  Update your project by including this item:  <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.6" />.  You can skip this warning by setting  <SkipValidateMauiImplicit
PackageReferences>true</SkipValidateMauiImplicitPackageReferences>  in your project file. [D:\Maui216\Maui216.csproj::TargetFramework=net8.0-maccatalyst]
C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\8.0.6\Sdk\BundledVersions.targets(85,5): warning MA002: Starting with .NET 8, setting  <UseMaui>true</UseMaui>  does not automatically include NuGet package re
ferences in your project.  Update your project by including this item:  <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.6" />.  You can skip this warning by setting  <SkipValidateMauiImplicit
PackageReferences>true</SkipValidateMauiImplicitPackageReferences>  in your project file. [D:\Maui216\Maui216.csproj::TargetFramework=net8.0-windows10.0.19041.0]
  All projects are up-to-date for restore.

D:\Maui216> dotnet list package
Project 'Maui216' has the following package references
   [net8.0-android34.0]:
   Top-level Package                               Requested   Resolved
   > Microsoft.Extensions.Logging.Debug            8.0.0       8.0.0
   > Microsoft.Maui.Controls                       8.0.6       8.0.6
   > Microsoft.Maui.Controls.Compatibility         8.0.6       8.0.6
   > Microsoft.NET.ILLink.Tasks              (A)   [8.0.1, )   8.0.1

nkolev92 avatar Feb 16 '24 23:02 nkolev92

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

ghost avatar Feb 19 '24 15:02 ghost

@mattleibow It seems the messaging text is misleading here, and we should correct it.

Redth avatar Feb 19 '24 16:02 Redth