unoplatform / uno.templates

Uno Platform project templates
https://platform.uno/
Other
16 stars 9 forks source link

[MauiEmbedding] MauiCommunityToolkit - Nugget Package manager exception error. #744

Closed Darsh0307 closed 3 weeks ago

Darsh0307 commented 2 months ago

Current behavior

There is an exception showing when we are trying to add CommunityToolkit.MVVM as nuget package manager. But when we are adding it, there is an exception showing. Its showing me an error message to downgrade the pacakge. At the same time the pacakages are on 8.0.14.

image

CACHE https://api.nuget.org/v3-vulnerabilities/2024.04.25.01.10.39/vulnerability.base.json
  CACHE https://api.nuget.org/v3-vulnerabilities/2024.04.25.01.10.39/2024.04.29.13.11.05/vulnerability.update.json
NU1605: Warning As Error: Detected package downgrade: Microsoft.Maui.Controls from 8.0.14 to 8.0.7. Reference the package directly from the project to select a different version. 
 MauiEmbeddingApp -> MauiEmbeddingApp.MauiControls -> Microsoft.Maui.Controls (>= 8.0.14) 
 MauiEmbeddingApp -> Microsoft.Maui.Controls (>= 8.0.7)
NU1605: Warning As Error: Detected package downgrade: Microsoft.Maui.Controls.Compatibility from 8.0.14 to 8.0.7. Reference the package directly from the project to select a different version. 
 MauiEmbeddingApp -> MauiEmbeddingApp.MauiControls -> Microsoft.Maui.Controls.Compatibility (>= 8.0.14) 
 MauiEmbeddingApp -> Microsoft.Maui.Controls.Compatibility (>= 8.0.7)
NU1605: Warning As Error: Detected package downgrade: Microsoft.Maui.Graphics from 8.0.14 to 8.0.7. Reference the package directly from the project to select a different version. 
 MauiEmbeddingApp -> MauiEmbeddingApp.MauiControls -> CommunityToolkit.Maui 8.0.1 -> CommunityToolkit.Maui.Core 8.0.1 -> Microsoft.Maui.Core 8.0.14 -> Microsoft.Maui.Graphics (>= 8.0.14) 
 MauiEmbeddingApp -> Microsoft.Maui.Graphics (>= 8.0.7)
NU1605: Warning As Error: Detected package downgrade: Microsoft.Maui.Graphics from 8.0.14 to 8.0.7. Reference the package directly from the project to select a different version. 
 MauiEmbeddingApp -> MauiEmbeddingApp.MauiControls -> CommunityToolkit.Maui 8.0.1 -> CommunityToolkit.Maui.Core 8.0.1 -> Microsoft.Maui.Essentials 8.0.14 -> Microsoft.Maui.Graphics (>= 8.0.14) 
 MauiEmbeddingApp -> Microsoft.Maui.Graphics (>= 8.0.7)
Package restore failed. Rolling back package changes for 'MauiEmbeddingApp'.
Time Elapsed: 00:00:00.6691913

Expected behavior

We should be able to add the nuget package easily in the project.

Templates Version

  1. "Uno.Sdk": "5.2.108"
  2. " Uno.templates" : 5.2.30

How to reproduce it (as minimally and precisely as possible)

  1. Create a MauiEmbeddingApp.
  2. Follow all the steps ,
  3. When you are in step 5 of Adding Drawing View , it is clearly mentioned that we have to add CommunityToolkit.MVVM in MauiEmbeddingApp\
  4. Try Adding the Nuget package manager

MauiEmbeddingApp.zip MauiEmbeddingApp_Debug_AnyCPU_net8.0-windows10.0.19041_Build_2024-04-30T14_25_55.7227510-04_00.zip

agneszitte commented 2 months ago

fyi @dansiegel, @jeromelaban Ask @Darsh0307 for more info as needed

nickrandolph commented 2 months ago

@Darsh0307 the guide should be updated to use the Mvvm feature to import CommunityToolkit.Mvvm @dansiegel should the guide be updated to set the MauiVersion explicitly?

dansiegel commented 2 months ago

@nickrandolph MauiVersion is set by the SDK you have installed so this should auto increment for the developer over time which is why the template uses $(MauiVersion) instead of an explicit version.

agneszitte commented 2 months ago

fyi @vatsashah45 since you are currently updating the mauiembedding samples to single project. Make sure to keep the documentation properly updated at the same time you are working on migrating the sample please

jeromelaban commented 3 weeks ago

This issue is now fixed with the auto upgrade of packages from the uno.sdk. This is a generally standard error that can happen when dependencies get updated to later versions than the ones we provide in the template. Bumping Microsoft.Maui.* in Direcctory.Build.props is the way to handle this.