Skip to content

[Windows] Upgrade Microsoft.Graphics.Win2D from 1.2.0 to 1.3.2 to fix a build warning #28885

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

MartyIX
Copy link
Contributor

@MartyIX MartyIX commented Apr 9, 2025

Description of Change

These warnings appear when one builds Essentials.DeviceTests.csproj (and other projects):

D:\a\1\s\.dotnet\sdk\9.0.100\Microsoft.Common.CurrentVersion.targets(43,3): warning MSB4011: "C:\Users\VssAdministrator\.nuget\packages\microsoft.windowsappsdk\1.5.240227000\buildTransitive\Microsoft.Build.Msix.props" cannot be imported again. It was already imported at "C:\Users\VssAdministrator\.nuget\packages\microsoft.windowsappsdk\1.5.240227000\buildTransitive\Microsoft.WinUI.props (22,3)". This is most likely a build authoring error. This subsequent import will be ignored. [D:\a\1\s\src\Essentials\src\Essentials.csproj]
D:\a\1\s\.dotnet\sdk\9.0.100\Microsoft.Common.CurrentVersion.targets(43,3): warning MSB4011: "C:\Users\VssAdministrator\.nuget\packages\microsoft.windowsappsdk\1.5.240227000\buildTransitive\Microsoft.Build.Msix.props" cannot be imported again. It was already imported at "C:\Users\VssAdministrator\.nuget\packages\microsoft.windowsappsdk\1.5.240227000\buildTransitive\Microsoft.WinUI.props (22,3)". This is most likely a build authoring error. This subsequent import will be ignored. [D:\a\1\s\src\Essentials\src\Essentials.csproj]
D:\a\1\s\.dotnet\sdk\9.0.100\Microsoft.Common.CurrentVersion.targets(43,3): warning MSB4011: "C:\Users\VssAdministrator\.nuget\packages\microsoft.windowsappsdk\1.5.240227000\buildTransitive\Microsoft.Build.Msix.props" cannot be imported again. It was already imported at "C:\Users\VssAdministrator\.nuget\packages\microsoft.windowsappsdk\1.5.240227000\buildTransitive\Microsoft.WinUI.props (22,3)". This is most likely a build authoring error. This subsequent import will be ignored. [D:\a\1\s\src\Graphics\src\Graphics\Graphics.csproj]
D:\a\1\s\.dotnet\sdk\9.0.100\Microsoft.Common.CurrentVersion.targets(43,3): warning MSB4011: "C:\Users\VssAdministrator\.nuget\packages\microsoft.windowsappsdk\1.5.240227000\buildTransitive\Microsoft.Build.Msix.props" cannot be imported again. It was already imported at "C:\Users\VssAdministrator\.nuget\packages\microsoft.windowsappsdk\1.5.240227000\buildTransitive\Microsoft.WinUI.props (22,3)". This is most likely a build authoring error. This subsequent import will be ignored. [D:\a\1\s\src\Graphics\src\Graphics\Graphics.csproj]
D:\a\1\s\.dotnet\sdk\9.0.100\Microsoft.Common.CurrentVersion.targets(43,3): warning MSB4011: "C:\Users\VssAdministrator\.nuget\packages\microsoft.windowsappsdk\1.5.240227000\buildTransitive\Microsoft.Build.Msix.props" cannot be imported again. It was already imported at "C:\Users\VssAdministrator\.nuget\packages\microsoft.windowsappsdk\1.5.240227000\buildTransitive\Microsoft.WinUI.props (22,3)". This is most likely a build authoring error. This subsequent import will be ignored. [D:\a\1\s\src\Graphics\src\Graphics.Win2D\Graphics.Win2D.csproj]
D:\a\1\s\.dotnet\sdk\9.0.100\Microsoft.Common.CurrentVersion.targets(43,3): warning MSB4011: "C:\Users\VssAdministrator\.nuget\packages\microsoft.windowsappsdk\1.5.240227000\buildTransitive\Microsoft.Build.Msix.props" cannot be imported again. It was already imported at "C:\Users\VssAdministrator\.nuget\packages\microsoft.windowsappsdk\1.5.240227000\buildTransitive\Microsoft.WinUI.props (22,3)". This is most likely a build authoring error. This subsequent import will be ignored. [D:\a\1\s\src\Graphics\src\Graphics.Win2D\Graphics.Win2D.csproj]

(Full CI output)

Notice that the warnings mention WinAppSDK version 1.5 and not 1.6 that is used by MAUI right now.

It appears to be caused by using older version of Microsoft.Graphics.Win2D (i.e. 1.2.0 instead of the latest 1.3.2) -- see dependencies of 1.2.0. Version 1.3.2 requires WinAppSDK 1.6..

Changelog for the library is available here: https://github.com/microsoft/Win2D/blob/winappsdk/main/CHANGELOG.md.

@MartyIX MartyIX requested a review from a team as a code owner April 9, 2025 12:11
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Apr 9, 2025
Copy link
Contributor

Hey there @@MartyIX! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@MartyIX MartyIX requested a review from mattleibow April 9, 2025 12:11
@MartyIX MartyIX requested review from rmarinho and removed request for StephaneDelcroix April 9, 2025 12:15
@bronteq
Copy link

bronteq commented Apr 9, 2025

@MartyIX maybe you can change the nuget version in eng/Version.props file like you did here: #28499

Line 66, there is the specific tag <MicrosoftGraphicsWin2DPackageVersion>1.2.0</MicrosoftGraphicsWin2DPackageVersion>

@MartyIX
Copy link
Contributor Author

MartyIX commented Apr 9, 2025

Ah. My bad. Thank you. Will change in a couple of hours.

@MartyIX MartyIX force-pushed the feature/2025-09-04-Upgrade-Microsoft.Graphics.Win2D branch from 48a505a to 7369a06 Compare April 9, 2025 15:18
@rmarinho
Copy link
Member

rmarinho commented Apr 9, 2025

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen
Copy link
Member

PureWeen commented Apr 9, 2025

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@MartyIX
Copy link
Contributor Author

MartyIX commented Apr 10, 2025

@Sergio0694 Does the PR look OK to you please?

@@ -38,6 +38,7 @@
<ItemGroup Condition=" $(TargetFramework.Contains('-windows')) ">
<Compile Include="**\*.uwp.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
<Compile Include="**\*.uwp.*.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
<PackageReference Include="Microsoft.Web.WebView2" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need the webview2 here?

Is the webview required to update? Can we do it in a different PR to get better history.

Also, check all projects for references to win2d just in case the is a rogue explicit version.

Copy link
Contributor Author

@MartyIX MartyIX Apr 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the webview required to update? Can we do it in a different PR to get better history.

It is not1 needed (AFAIK). So I reverted it.

Why do you need the webview2 here?

Well, a simple answer is that "without it, the compilation fails" with: src\Screenshot\Screenshot.uwp.cs(34,19): error CS0012: The type 'CoreWebView2' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.Web.WebView2.Core.Projection, Version=1.0.2651.64, Culture=neutral, PublicKeyToken=2a8ab48044d2601e'. So I added the WebView2 reference. I'm not sure if there is a better way to fix it.

Also, check all projects for references to win2d just in case the is a rogue explicit version.

I have just done it and I couldn't find anything wrong.

Footnotes

  1. The original idea was that having two up-to-date dependencies feels like they might work together better. Just an idea.

Copy link

@Sergio0694 Sergio0694 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just +1 to Matt's comment, why that new WebView2 package reference?

@MartyIX MartyIX force-pushed the feature/2025-09-04-Upgrade-Microsoft.Graphics.Win2D branch from 22eda3e to 3312ca7 Compare April 11, 2025 09:55
@MartyIX
Copy link
Contributor Author

MartyIX commented Apr 11, 2025

LGTM, just +1 to Matt's comment, why that new WebView2 package reference?

Without it, the src\Essentials project does not compile, but I'm not exactly sure why it compiled before and not now. I mentioned the exact error message here: #28885 (comment)

@rmarinho
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants