WindowsAppSDK icon indicating copy to clipboard operation
WindowsAppSDK copied to clipboard

1.1 preview 1 breaks NET5.0 and 6.0 projects.

Open dhoehna opened this issue 2 years ago • 6 comments

Describe the bug

Adding Windows App SDK 1.1-Preview 1 to a .NET projects causes the project build to fail, saying that "Target Framework is empty". Specifically: A numeric comparison was attempted on "$(TargetPlatformVersion)" that evaluates to "" instead of a number, in condition "'$(TargetPlatformVersion)' < '10.0.18362.0'". C:\Users\dahoehna.nuget\packages\microsoft.windowsappsdk\1.1.0-preview1\buildTransitive\Microsoft.InteractiveExperiences.Common.targets

Steps to reproduce the bug

  1. Make a new C# project targeting either 5.0 or 6.0.
  2. Install the nuget package for Windows App SDK 1.1-Preview 1.

Expected behavior

A message in the build output asking to add the windows version to the "TargetFramework" attribute in the csproj.

Screenshots

No response

NuGet package version

No response

Packaging type

Unpackaged

Windows version

No response

IDE

Visual Studio 2022

Additional context

There is currently a workaround by adding the version manually.

Change <TargetFramework>net6.0</TargetFramework> to <TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>

dhoehna avatar Mar 30 '22 18:03 dhoehna

Yup, I run into this brick wall a lot, to the point where I learned to check TFM when strange things start happening. When this occurs you typically lose access to the project file editing experience too, making it very difficult to quickly fix. Generally Visual Studio requires a restart once in this state.

riverar avatar Mar 30 '22 19:03 riverar

This issue is still very much present, but can be aggravated in cross-targeted projects by the NuGet package manager not supporting conditional ItemGroups properly: https://developercommunity.visualstudio.com/t/NuGet-Package-manager-does-not-honor-con/10269291

jeromelaban avatar Feb 02 '23 14:02 jeromelaban

@manodasanW There's been another instance of this, see https://developercommunity.visualstudio.com/t/installing-WindowsAppSDK-can-lead-to-pro/10429073

Can the targets be updated to avoid this comparison when TargetPlatformVersion isn't set?

MSLukeWest avatar Nov 10 '23 20:11 MSLukeWest

This is still an issue when converting from net7.0 to net8.0 in Uno projects, viz

A numeric comparison was attempted on "$(TargetPlatformVersion)" that evaluates to "" instead of a number, in condition "'$(TargetPlatformIdentifier)' == 'Windows' and
 '$(TargetPlatformVersion)' >= '8.0'".  C:\Users\Daisy\.nuget\packages\microsoft.windowsappsdk\1.5.240607001\buildTransitive\Microsoft.UI.Xaml.Markup.Compiler.interop.targets

axtens avatar Jun 27 '24 01:06 axtens

replace this line in file : C:\Users\dahoehna.nuget\packages\microsoft.windowsappsdk\1.1.0-preview1\buildTransitive\Microsoft.InteractiveExperiences.Common.targets

Line to replace: <Ixp-UAPTargetVersion Condition="'$(TargetPlatformVersion)' &lt; '10.0.18362.0'">uap10.0.17763</Ixp-UAPTargetVersion> TO: <Ixp-UAPTargetVersion Condition=" '$(TargetPlatformVersion)' != '' And '$(TargetPlatformVersion)' &lt; '10.0.18362.0'">uap10.0.17763</Ixp-UAPTargetVersion>

WILL RESOLVE THIS ISSUE :)

ramiz272 avatar Jul 01 '24 16:07 ramiz272

This is still an issue when converting from net7.0 to net8.0 in Uno projects, viz

A numeric comparison was attempted on "$(TargetPlatformVersion)" that evaluates to "" instead of a number, in condition "'$(TargetPlatformIdentifier)' == 'Windows' and
 '$(TargetPlatformVersion)' >= '8.0'".  C:\Users\Daisy\.nuget\packages\microsoft.windowsappsdk\1.5.240607001\buildTransitive\Microsoft.UI.Xaml.Markup.Compiler.interop.targets

replace this line in file : C:\Users\Daisy.nuget\packages\microsoft.windowsappsdk\1.5.240607001\buildTransitive\Microsoft.UI.Xaml.Markup.Compiler.interop.targets

Line to replace: <Ixp-UAPTargetVersion Condition="'$(TargetPlatformVersion)' &lt; '10.0.18362.0'">uap10.0.17763</Ixp-UAPTargetVersion> TO: <Ixp-UAPTargetVersion Condition=" '$(TargetPlatformVersion)' != '' And '$(TargetPlatformVersion)' &lt; '10.0.18362.0'">uap10.0.17763</Ixp-UAPTargetVersion>

WILL RESOLVE THIS ISSUE :)

ramiz272 avatar Jul 01 '24 16:07 ramiz272