WindowsAppSDK icon indicating copy to clipboard operation
WindowsAppSDK copied to clipboard

Latest VisualStudio update as of yesterday breaks solutions which use WindowsAppSDK 1.5.X

Open DierkDroth opened this issue 1 year ago • 5 comments

Describe the bug

Please see repo below which uses WindowsAppSDK 1.5.X. This no longer builds but throws this error

error CS0433: The type 'TextDecorations' exists in both 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b' and 'Microsoft.Windows.SDK.NET, Version=10.0.19041.38, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

Minimal.zip

Steps to reproduce the bug

See above

Expected behavior

WindowsAppSDK 1.5.X solutions should build using latest VisualStudio updates.

Screenshots

Image

NuGet package version

None

Packaging type

No response

Windows version

No response

IDE

No response

Additional context

No response

DierkDroth avatar Oct 09 '24 12:10 DierkDroth

Hello, I have the same problem

LucBurlet avatar Oct 10 '24 08:10 LucBurlet

Same for me. But I am getting other errors:

Image

<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.240923002" />

// csproj
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<WindowsSdkPackageVersion>10.0.22621.45</WindowsSdkPackageVersion>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>

// The error originates from an obj folder
obj\x64\Debug\net8.0-windows10.0.22621.0\win-x64\intermediatexaml\WinRT.SourceGenerator\Generator.WinRTAotSourceGenerator\WinRTGenericInstantiation.g.cs(3534,72,3534,88): error CS0117: 'HttpProgress' does not contain a definition for 'CreateMarshaler2'
obj\x64\Debug\net8.0-windows10.0.22621.0\win-x64\intermediatexaml\WinRT.SourceGenerator\Generator.WinRTAotSourceGenerator\WinRTGenericInstantiation.g.cs(3535,238,3535,252): error CS1503: Argument 1: cannot convert from 'ABI.Windows.Web.Http.HttpProgress' to 'ABI.Windows.Web.Http.HttpProgress.Marshaler'
obj\x64\Debug\net8.0-windows10.0.22621.0\win-x64\intermediatexaml\WinRT.SourceGenerator\Generator.WinRTAotSourceGenerator\WinRTGenericInstantiation.g.cs(3540,72,3540,86): error CS1503: Argument 1: cannot convert from 'ABI.Windows.Web.Http.HttpProgress' to 'ABI.Windows.Web.Http.HttpProgress.Marshaler'

Everything works fine under visual studio 17.11.4.

persskog avatar Oct 10 '24 09:10 persskog

Same for me. But I am getting other errors:

Image

<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.240923002" />

Everything works fine under visual studio 17.11.4.

@persskog you're on WindowsAppSDK 1.6.X, so your issue is not related to my original report - which is about WindowsAppSDK 1.5.X. I recommend you opened a new issue to not confuse matters. Thanks

DierkDroth avatar Oct 10 '24 09:10 DierkDroth

The recent Windows SDK projection update did add some Windows namespace types to address another issue. Most of those overlapping types were duplicate types between the Microsoft and Windows namespaces and the Windows namespace ones were unused in WinUI scenarios. But there were a couple that are used like TextDecorations which when explicitly used will run into this issue. We have addressed this in WinAppSDK 1.6, which was built with the new Windows SDK projection update, by declaring those types as forwarded to the Windows SDK projection.

If you are able to move to WinAppSDK 1.6, that should address this issue. Otherwise, if you want to stay on 1.5, you can use the older Windows SDK projection version (.34) by specifying the below property in your csproj or in a common props file which should keep things working. Once you are able to move to 1.6, you should remove the property.

<PropertyGroup>
    <WindowsSdkPackageVersion>10.0.19041.34</WindowsSdkPackageVersion>
</PropertyGroup>

Same for me. But I am getting other errors:

Image

<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.240923002" />

// csproj
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<WindowsSdkPackageVersion>10.0.22621.45</WindowsSdkPackageVersion>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>

// The error originates from an obj folder
obj\x64\Debug\net8.0-windows10.0.22621.0\win-x64\intermediatexaml\WinRT.SourceGenerator\Generator.WinRTAotSourceGenerator\WinRTGenericInstantiation.g.cs(3534,72,3534,88): error CS0117: 'HttpProgress' does not contain a definition for 'CreateMarshaler2'
obj\x64\Debug\net8.0-windows10.0.22621.0\win-x64\intermediatexaml\WinRT.SourceGenerator\Generator.WinRTAotSourceGenerator\WinRTGenericInstantiation.g.cs(3535,238,3535,252): error CS1503: Argument 1: cannot convert from 'ABI.Windows.Web.Http.HttpProgress' to 'ABI.Windows.Web.Http.HttpProgress.Marshaler'
obj\x64\Debug\net8.0-windows10.0.22621.0\win-x64\intermediatexaml\WinRT.SourceGenerator\Generator.WinRTAotSourceGenerator\WinRTGenericInstantiation.g.cs(3540,72,3540,86): error CS1503: Argument 1: cannot convert from 'ABI.Windows.Web.Http.HttpProgress' to 'ABI.Windows.Web.Http.HttpProgress.Marshaler'

Everything works fine under visual studio 17.11.4.

This has been addressed in the latest Windows SDK projection update which should be available in next month's .NET SDK release. If you want to try it out earlier, you can specify the WindowsSdkPackageVersion property to the appropriate version based on TFM listed here.

manodasanW avatar Oct 15 '24 06:10 manodasanW

Moved to 10.0.xxxxx.53 and now it works, thanks!

persskog avatar Oct 15 '24 09:10 persskog

error CS0433: The type 'TextDecorations' exists in both 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b' and 'Microsoft.Windows.SDK.NET, Version=10.0.19041.38, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

@manodasanW, the above issue occurs in latest VS2022 stable version[17.11.5] and VS2022 preview version[17.12.0 Preview 5.0]. Currently we could not able to update WindowsAppSdk version to latest version.

Is there any specific .NET SDK release version or date to fix this issue?

SubashiniMahendran avatar Nov 07 '24 06:11 SubashiniMahendran

@SubashiniMahendran If you can't yet update to the latest WinAppSDK version, the recommendation is to lock your Windows SDK projection version to the version before those types were added to it. You just need to add something like the below to your csproj or a common props file assuming you are targeting 19041 in the target framework. When you move to WinAppSDK 1.6, you can remove it.

<PropertyGroup>
    <WindowsSdkPackageVersion>10.0.19041.34</WindowsSdkPackageVersion>
</PropertyGroup>

manodasanW avatar Nov 08 '24 04:11 manodasanW

Close this issue as solution is provided.

LegendaryBlair avatar Dec 12 '24 05:12 LegendaryBlair