Skip to content

Commit b7acc04

Browse files
Attempt Windows 10 and Server 2019 compatibility
1 parent 47dc9d3 commit b7acc04

7 files changed

Lines changed: 72 additions & 6 deletions

File tree

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/env pwsh
2+
<#
3+
.SYNOPSIS
4+
Validates that Package.appxmanifest target device family metadata stays in
5+
sync with the current Windows target platform version.
6+
7+
.PARAMETER ManifestPath
8+
Path to the Package.appxmanifest file to validate.
9+
10+
.PARAMETER ExpectedMinVersion
11+
Expected MinVersion value for every TargetDeviceFamily entry.
12+
13+
.PARAMETER ExpectedMaxVersionTested
14+
Expected MaxVersionTested value for every TargetDeviceFamily entry.
15+
#>
16+
17+
[CmdletBinding()]
18+
param(
19+
[Parameter(Mandatory, Position = 0)]
20+
[string] $ManifestPath,
21+
22+
[Parameter(Mandatory)]
23+
[string] $ExpectedMinVersion,
24+
25+
[Parameter(Mandatory)]
26+
[string] $ExpectedMaxVersionTested
27+
)
28+
29+
$ErrorActionPreference = 'Stop'
30+
31+
if (-not (Test-Path $ManifestPath -PathType Leaf)) {
32+
throw "The manifest '$ManifestPath' does not exist."
33+
}
34+
35+
$ManifestPath = (Resolve-Path $ManifestPath).Path
36+
[xml] $Manifest = Get-Content $ManifestPath
37+
38+
$TargetDeviceFamilies = @($Manifest.Package.Dependencies.TargetDeviceFamily)
39+
if ($TargetDeviceFamilies.Count -eq 0) {
40+
throw "No TargetDeviceFamily entries were found in '$ManifestPath'."
41+
}
42+
43+
$MismatchedTargetFamilies = @()
44+
foreach ($TargetDeviceFamily in $TargetDeviceFamilies) {
45+
if (
46+
$TargetDeviceFamily.MinVersion -ne $ExpectedMinVersion -or
47+
$TargetDeviceFamily.MaxVersionTested -ne $ExpectedMaxVersionTested
48+
) {
49+
$MismatchedTargetFamilies += "$($TargetDeviceFamily.Name)=Min:$($TargetDeviceFamily.MinVersion)|Max:$($TargetDeviceFamily.MaxVersionTested)"
50+
}
51+
}
52+
53+
if ($MismatchedTargetFamilies.Count -gt 0) {
54+
throw "Package.appxmanifest target family mismatch. Expected MinVersion '$ExpectedMinVersion' and MaxVersionTested '$ExpectedMaxVersionTested' for all TargetDeviceFamily entries but found: $($MismatchedTargetFamilies -join ', ')."
55+
}

src/Directory.Build.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<PropertyGroup>
1414
<PortableTargetFramework>net10.0</PortableTargetFramework>
1515
<WindowsTargetPlatformVersion>10.0.26100.0</WindowsTargetPlatformVersion>
16+
<WindowsMinimumSupportedVersion>10.0.17763.0</WindowsMinimumSupportedVersion>
1617
<WindowsTargetFramework>$(PortableTargetFramework)-windows$(WindowsTargetPlatformVersion)</WindowsTargetFramework>
1718
</PropertyGroup>
1819

@@ -34,7 +35,7 @@
3435
</PropertyGroup>
3536

3637
<PropertyGroup Condition="$([System.String]::Copy('$(TargetFramework)').Contains('-windows'))">
37-
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
38+
<TargetPlatformMinVersion>$(WindowsMinimumSupportedVersion)</TargetPlatformMinVersion>
3839
<WindowsSdkPackageVersion>10.0.26100.56</WindowsSdkPackageVersion>
3940
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
4041
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>

src/SharedAssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
[assembly: AssemblyFileVersion("3.3.7.0")]
1313
[assembly: AssemblyInformationalVersion("3.3.7")]
1414
#if WINDOWS
15-
[assembly: SupportedOSPlatform("windows10.0.19041")]
15+
[assembly: SupportedOSPlatform("windows10.0.17763")]
1616
#endif

src/UniGetUI.PAckageEngine.Interfaces/UniGetUI.PackageEngine.Interfaces.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<PropertyGroup>
77
<SupportedOSPlatformVersion Condition="'$(TargetFramework)' == '$(WindowsTargetFramework)'"
8-
>10.0.19041.0</SupportedOSPlatformVersion
8+
>$(WindowsMinimumSupportedVersion)</SupportedOSPlatformVersion
99
>
1010
<FileVersion>3.1.0.0</FileVersion>
1111
<InformationalVersion>3.1.0-beta0</InformationalVersion>

src/UniGetUI/Package.appxmanifest

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
</Properties>
2222

2323
<Dependencies>
24-
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
25-
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
24+
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.26100.0" />
25+
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.26100.0" />
2626
</Dependencies>
2727

2828
<Resources>

src/UniGetUI/Properties/PublishProfiles/win10-x64.pubxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
66
<PropertyGroup>
77
<PublishProtocol>FileSystem</PublishProtocol>
88
<Platform>x64</Platform>
9-
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
9+
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
1010
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
1111
<SelfContained>true</SelfContained>
1212
<PublishSingleFile>False</PublishSingleFile>

src/UniGetUI/UniGetUI.csproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@
5656
/>
5757
</Target>
5858

59+
<Target
60+
Name="ValidatePackageManifestTargetFamilies"
61+
BeforeTargets="PrepareForBuild"
62+
Condition="'$(DesignTimeBuild)' != 'true'"
63+
>
64+
<Exec
65+
Command="pwsh -NoProfile -File ../../scripts/validate-package-manifest.ps1 -ManifestPath &quot;Package.appxmanifest&quot; -ExpectedMinVersion &quot;$(WindowsMinimumSupportedVersion)&quot; -ExpectedMaxVersionTested &quot;$(WindowsTargetPlatformVersion)&quot;"
66+
/>
67+
</Target>
68+
5969
<Target
6070
Name="EnsureBundledElevatorFromNuGet"
6171
BeforeTargets="PrepareForBuild"

0 commit comments

Comments
 (0)