WindowsAppSDK
WindowsAppSDK copied to clipboard
SupportedOSPlatform is ignored by the installer
Describe the bug
We have upgraded our TargetFramework to net8.0-windows10.0.22621.0, but left the SupportedOSPlatform on 10.0.19041.0. However, doing this means the installer no longer allows us to install our windows APP on any Windows version older then 22621.
Is this intentional? If so, what is the point of SupportedOSPlatform?
Steps to reproduce the bug
Set your settings as follows:
Expected behavior
We are able to install on Windows version 14091.
Screenshots
The installer returns the following reason for installation failure:
App installation failed with error message: Windows cannot install package
NuGet package version
Windows App SDK 1.5.6: 1.5.240802000
Packaging type
Packaged (MSIX)
Windows version
Windows 10 version 2004 (19041, May 2020 Update)
IDE
Visual Studio 2022
Additional context
We have to upgrade the TFM due to the CommunityToolkit requiring this for an upcoming version. But I have tested this behavior without those new packages (so only the above mentioned change) and this error still happens.
We are creating the installer as follows:
- task: CmdLine@2 displayName: Bundle msix files to msixbundle continueOnError: true inputs: script: | "C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64\makeappx.exe" bundle /d $(Build.ArtifactStagingDirectory)\ /p "$(Build.ArtifactStagingDirectory)$(applicationName).msixbundle"
I have found the solution. The Windows Project files requires <TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
The AppXManifest.xml file gets the MinVersion from this property. But with a WinUI app this property is not usually present in the .csproj file. Instead, it has the SupportedOSPlatformVersion property, however, this is not used for the AppXManifest.xml file and thus not used for the manifest of the Bundle.
I think SupportedOSPlatform is not part of WinAppSDK templates and is not used at all by WinAppSDK. TargetPlatformMinVersion is in the template and there is also a MinVersion specified on TargetDeviceFamily in the Package.appxmanifest, which I believe is what the installer checks. We should see if everything here makes sense.
That is what we thought as well. But that is not what we are seeing.
TargetPlatformMinVersion is what is determining the value that gets places in AppxManifest.xml by the compiler.
The value in AppxManifest.xml is what is determining what gets used by MakeApp.exe and put in the msixbundle in the <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.19041.0"/>
MaxVersionTested="10.0.19041.0"
P.S. That means you're telling Windows "I don't understand anything newer than 10.0.19041.0. Hide any such behaviors from me." That'll prevent you from using features in appxmanifest.xml newer than 10.0.19041.0.
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.22621.0"/> means to install you require >=10.0.19041.0 but understand how to run on that and newer systems <= 10.0.22621.0 so 'light up' behavior >=10.0.19041.0 on newer systems.
@DrusTheAxe Well, that is what is placed there by the compiler it seems, we are not setting this there directly.
@DrusTheAxe Well, that is what is placed there by the compiler it seems, we are not setting this there directly.
It'll be set by VS, or some .props/targets/tasks provided by VS or friends as part of the package.appxmanifest-to-appxmanifest.xml transformation VS projects do as part of their build process.
@Scottj1s this is more up your alley than mine. Got any advice on this one?