How to resolve CS0433 error when building WindowsAppSDK 1.5.X solutions after Visual Studio update? #5131
-
DescriptionAfter updating Visual Studio, building a project using WindowsAppSDK 1.5.X results in the following error: 'error CS0433: The type 'TextDecorations' exists in both 'Microsoft.WinUI, Version=3.0.0.0' and 'Microsoft.Windows.SDK.NET, Version=10.0.19041.38'. This issue prevents the project from building successfully. How to resolve this issue? Related issues |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Root causeThe error occurs due to a recent Windows SDK projection update that added some SolutionTo resolve this issue, you can either update to WinAppSDK 1.6 or above, which addresses this conflict, or specify an older Windows SDK projection version in your project file. <PropertyGroup>
<WindowsSdkPackageVersion>10.0.19041.34</WindowsSdkPackageVersion>
</PropertyGroup> Once you are able to move to WinAppSDK 1.6 or above, you should remove this property. |
Beta Was this translation helpful? Give feedback.
Root cause
The error occurs due to a recent Windows SDK projection update that added some
Windows
namespace types, includingTextDecorations
, which overlap with types in theMicrosoft
namespace. This causes a conflict when building projects using WindowsAppSDK 1.5.X.Solution
To resolve this issue, you can either update to WinAppSDK 1.6 or above, which addresses this conflict, or specify an older Windows SDK projection version in your project file.
To specify an older version, you will need to add the
WindowsSdkPackageVersion
property to your csproj to lock the Windows SDK projection version to 34. Let's say your project is targeting at Windows 10.0.19041.0, then set the property as the f…