winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 9a6dbc2eeed3a4068aebea2a1b25ca5e6a43d0bf
parent 647b28579be6361aa9bf59431c0874e5d52e2558
Author: yao-msft <50888816+yao-msft@users.noreply.github.com>
Date:   Fri, 25 Feb 2022 16:51:53 -0800

Allow PackageFamilyName to be declared with non msix installers (#1944)


Diffstat:
Msrc/AppInstallerCLITests/AppInstallerCLITests.vcxproj | 3+++
Msrc/AppInstallerCLITests/AppInstallerCLITests.vcxproj.filters | 3+++
Asrc/AppInstallerCLITests/TestData/Manifest-Good-PackageFamilyNameOnExe-Ver1_2.yaml | 24++++++++++++++++++++++++
Msrc/AppInstallerCLITests/YamlManifest.cpp | 1+
Msrc/AppInstallerCommonCore/Manifest/ManifestValidation.cpp | 3++-
5 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/src/AppInstallerCLITests/AppInstallerCLITests.vcxproj b/src/AppInstallerCLITests/AppInstallerCLITests.vcxproj @@ -473,6 +473,9 @@ <CopyFileToFolders Include="TestData\Manifest-Good-DefaultExpectedReturnCodeInInstallerSuccessCodes.yaml"> <DeploymentContent>true</DeploymentContent> </CopyFileToFolders> + <CopyFileToFolders Include="TestData\Manifest-Good-PackageFamilyNameOnExe-Ver1_2.yaml"> + <DeploymentContent>true</DeploymentContent> + </CopyFileToFolders> <CopyFileToFolders Include="TestData\Manifest-Encoding-ANSI.yaml"> <DeploymentContent>true</DeploymentContent> </CopyFileToFolders> diff --git a/src/AppInstallerCLITests/AppInstallerCLITests.vcxproj.filters b/src/AppInstallerCLITests/AppInstallerCLITests.vcxproj.filters @@ -378,6 +378,9 @@ <CopyFileToFolders Include="TestData\Manifest-Good-MultiLocale.yaml"> <Filter>TestData</Filter> </CopyFileToFolders> + <CopyFileToFolders Include="TestData\Manifest-Good-PackageFamilyNameOnExe-Ver1_2.yaml"> + <Filter>TestData</Filter> + </CopyFileToFolders> <CopyFileToFolders Include="TestData\Manifest-Good-Spaces.yaml"> <Filter>TestData</Filter> </CopyFileToFolders> diff --git a/src/AppInstallerCLITests/TestData/Manifest-Good-PackageFamilyNameOnExe-Ver1_2.yaml b/src/AppInstallerCLITests/TestData/Manifest-Good-PackageFamilyNameOnExe-Ver1_2.yaml @@ -0,0 +1,24 @@ +PackageIdentifier: Microsoft.WinAppSdk +Publisher: Microsoft +PackageName: WinAppSdk +PackageVersion: 1.0 +License: Microsoft Software License +MinimumOSVersion: 10.0.17763.0 +Tags: +- WinAppSdk +ShortDescription: WinAppSdk +PackageUrl: https://github.com/microsoft/WindowsAppSDK +Installers: +- Architecture: x86 + InstallerType: exe + InstallerUrl: https://ThisIsTest.com/TestIndex/installer/WindowsAppRuntimeInstall.exe + InstallerSha256: b565f45da868b637686d4c098e9e4c3e16424cff1ed2f19d5665602fdd8dfba6 + PackageFamilyName: MicrosoftCorporationII.WindowsAppRuntime.Main.1.0_8wekyb3d8bbwe + AppsAndFeaturesEntries: + - InstallerType: msix + InstallerSwitches: + Silent: /s + SilentWithProgress: /s +PackageLocale: en-US +ManifestType: singleton +ManifestVersion: 1.2.0 diff --git a/src/AppInstallerCLITests/YamlManifest.cpp b/src/AppInstallerCLITests/YamlManifest.cpp @@ -221,6 +221,7 @@ TEST_CASE("ReadGoodManifests", "[ManifestValidation]") { "Manifest-Good-Minimum-InstallerType.yaml" }, { "Manifest-Good-Switches.yaml" }, { "Manifest-Good-DefaultExpectedReturnCodeInInstallerSuccessCodes.yaml" }, + { "Manifest-Good-PackageFamilyNameOnExe-Ver1_2.yaml" }, }; for (auto const& testCase : TestCases) diff --git a/src/AppInstallerCommonCore/Manifest/ManifestValidation.cpp b/src/AppInstallerCommonCore/Manifest/ManifestValidation.cpp @@ -97,7 +97,8 @@ namespace AppInstaller::Manifest } // Validate system reference strings if they are set at the installer level - if (!installer.PackageFamilyName.empty() && !DoesInstallerTypeUsePackageFamilyName(installer.InstallerType)) + // Allow PackageFamilyName to be declared with non msix installers to support nested installer scenarios after manifest version 1.1 + if (manifest.ManifestVersion <= ManifestVer{ s_ManifestVersionV1_1 } && !installer.PackageFamilyName.empty() && !DoesInstallerTypeUsePackageFamilyName(installer.InstallerType)) { resultErrors.emplace_back(ManifestError::InstallerTypeDoesNotSupportPackageFamilyName, "InstallerType", InstallerTypeToString(installer.InstallerType)); }