diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5f8cee5a4..ef49c2ed1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -114,7 +114,7 @@ jobs: path: build/logs/ - name: Publish nuget packages to github - if: ${{ github.event.inputs.publish_nuget == 'true' }} && ${{ github.ref == 'refs/heads/develop-psw-wix' }} + if: github.event.inputs.publish_nuget == 'true' && github.ref == 'refs/heads/develop-psw-wix' env: GITHUB_TOKEN: ${{ secrets.MY_GITHUB_PAT }} run: | diff --git a/src/test/burn/TestData/ExePackageTests/PerMachineDetectVersionExePackage/PerMachineDetectVersionExePackage.wixproj b/src/test/burn/TestData/ExePackageTests/PerMachineDetectVersionExePackage/PerMachineDetectVersionExePackage.wixproj new file mode 100644 index 000000000..2aa7333e4 --- /dev/null +++ b/src/test/burn/TestData/ExePackageTests/PerMachineDetectVersionExePackage/PerMachineDetectVersionExePackage.wixproj @@ -0,0 +1,20 @@ + + + + Bundle + x64 + TestBA_x64 + {5923A558-091E-4015-A9CC-BA92E7A2405A} + + + + + + + + + + + + + diff --git a/src/test/burn/TestData/ExePackageTests/PerMachineDetectVersionExePackage/PerMachineDetectVersionExePackage.wxs b/src/test/burn/TestData/ExePackageTests/PerMachineDetectVersionExePackage/PerMachineDetectVersionExePackage.wxs new file mode 100644 index 000000000..800e6a4ae --- /dev/null +++ b/src/test/burn/TestData/ExePackageTests/PerMachineDetectVersionExePackage/PerMachineDetectVersionExePackage.wxs @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + diff --git a/src/test/burn/TestData/ExePackageTests/PerMachineDetectVersionExePackageFailure/PerMachineDetectVersionExePackageFailure.wixproj b/src/test/burn/TestData/ExePackageTests/PerMachineDetectVersionExePackageFailure/PerMachineDetectVersionExePackageFailure.wixproj new file mode 100644 index 000000000..8089e0abc --- /dev/null +++ b/src/test/burn/TestData/ExePackageTests/PerMachineDetectVersionExePackageFailure/PerMachineDetectVersionExePackageFailure.wixproj @@ -0,0 +1,19 @@ + + + + Bundle + {6436F747-08F7-416F-BE92-DB48F282AFC1} + + + + + + + + + + + + + + diff --git a/src/test/burn/TestData/ExePackageTests/PerMachineDetectVersionExePackageFailure/PerMachineDetectVersionExePackageFailure.wxs b/src/test/burn/TestData/ExePackageTests/PerMachineDetectVersionExePackageFailure/PerMachineDetectVersionExePackageFailure.wxs new file mode 100644 index 000000000..558222dbf --- /dev/null +++ b/src/test/burn/TestData/ExePackageTests/PerMachineDetectVersionExePackageFailure/PerMachineDetectVersionExePackageFailure.wxs @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + diff --git a/src/test/burn/TestData/ExePackageTests/PerMachineDetectVersionExePackageUninstallFailure/PerMachineDetectVersionExePackageUninstallFailure.wixproj b/src/test/burn/TestData/ExePackageTests/PerMachineDetectVersionExePackageUninstallFailure/PerMachineDetectVersionExePackageUninstallFailure.wixproj new file mode 100644 index 000000000..b3820cae4 --- /dev/null +++ b/src/test/burn/TestData/ExePackageTests/PerMachineDetectVersionExePackageUninstallFailure/PerMachineDetectVersionExePackageUninstallFailure.wixproj @@ -0,0 +1,19 @@ + + + + Bundle + {799DF604-49CB-4B2C-9FD9-A1C4F93A2FDE} + + + + + + + + + + + + + + diff --git a/src/test/burn/TestData/ExePackageTests/PerMachineDetectVersionExePackageUninstallFailure/PerMachineDetectVersionExePackageUninstallFailure.wxs b/src/test/burn/TestData/ExePackageTests/PerMachineDetectVersionExePackageUninstallFailure/PerMachineDetectVersionExePackageUninstallFailure.wxs new file mode 100644 index 000000000..e81df0d29 --- /dev/null +++ b/src/test/burn/TestData/ExePackageTests/PerMachineDetectVersionExePackageUninstallFailure/PerMachineDetectVersionExePackageUninstallFailure.wxs @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/burn/WixToolsetTest.BurnE2E/ExePackageTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/ExePackageTests.cs index 42301f300..f06191754 100644 --- a/src/test/burn/WixToolsetTest.BurnE2E/ExePackageTests.cs +++ b/src/test/burn/WixToolsetTest.BurnE2E/ExePackageTests.cs @@ -33,6 +33,28 @@ public void CanInstallAndUninstallPerMachineArpEntryExePackage() Assert.True(LogVerifier.MessageInLogFile(uninstallLogPath, $"testexe.exe\" /regd HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{arpId}")); } + [RuntimeFact] + public void CanInstallAndUninstallPerMachineDetectVersionExePackage() + { + var perMachineDetectVersionExePackageBundle = this.CreateBundleInstaller(@"PerMachineDetectVersionExePackage"); + var detectVersionExePackage = this.CreateArpEntryInstaller(perMachineDetectVersionExePackageBundle, "TestExe"); + var arpId = detectVersionExePackage.ArpId; + + detectVersionExePackage.VerifyRegistered(false); + + var installLogPath = perMachineDetectVersionExePackageBundle.Install(); + perMachineDetectVersionExePackageBundle.VerifyRegisteredAndInPackageCache(); + detectVersionExePackage.VerifyRegistered(true); + + Assert.True(LogVerifier.MessageInLogFile(installLogPath, $"TestExe.exe\" /regw \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{arpId},DisplayVersion,String,1.0.0.0\" /regw \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{arpId},QuietUninstallString,String,\\\"")); + + var uninstallLogPath = perMachineDetectVersionExePackageBundle.Uninstall(); + perMachineDetectVersionExePackageBundle.VerifyUnregisteredAndRemovedFromPackageCache(); + detectVersionExePackage.VerifyRegistered(false); + + Assert.True(LogVerifier.MessageInLogFile(uninstallLogPath, $"testexe.exe\" /regd HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{arpId}")); + } + [RuntimeFact] public void CanRecacheAndReinstallPerMachineArpEntryExePackageOnUninstallRollback() { @@ -67,6 +89,40 @@ public void CanRecacheAndReinstallPerMachineArpEntryExePackageOnUninstallRollbac Assert.True(LogVerifier.MessageInLogFile(uninstallLogPath, $"TestExe.exe\" /regw \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{arpId},DisplayVersion,String,1.0.0.0\" /regw \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{arpId},QuietUninstallString,String,\\\"")); } + [RuntimeFact] + public void CanRecacheAndReinstallPerMachineDetectVersionExePackageOnUninstallRollback() + { + var packageTestExe = this.CreatePackageInstaller("PackageTestExe"); + var perMachineDetectVersionExePackageUninstallFailureBundle = this.CreateBundleInstaller(@"PerMachineDetectVersionExePackageUninstallFailure"); + var arpEntryExePackage = this.CreateArpEntryInstaller(perMachineDetectVersionExePackageUninstallFailureBundle, "TestExe"); + var arpId = arpEntryExePackage.ArpId; + var testBAController = this.CreateTestBAController(); + + arpEntryExePackage.VerifyRegistered(false); + packageTestExe.VerifyInstalled(false); + + testBAController.SetPackageRequestedCacheType("TestExe", BOOTSTRAPPER_CACHE_TYPE.Remove); + + var installLogPath = perMachineDetectVersionExePackageUninstallFailureBundle.Install(); + perMachineDetectVersionExePackageUninstallFailureBundle.VerifyRegisteredAndInPackageCache(); + arpEntryExePackage.VerifyRegistered(true); + packageTestExe.VerifyInstalled(true); + + Assert.True(LogVerifier.MessageInLogFile(installLogPath, $"TestExe.exe\" /regw \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{arpId},DisplayVersion,String,1.0.0.0\" /regw \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{arpId},QuietUninstallString,String,\\\"")); + + testBAController.ResetPackageStates("TestExe"); + testBAController.SetAllowAcquireAfterValidationFailure(); + + var uninstallLogPath = perMachineDetectVersionExePackageUninstallFailureBundle.Uninstall((int)MSIExec.MSIExecReturnCode.ERROR_INSTALL_FAILURE, "FAILWHENDEFERRED=1"); + perMachineDetectVersionExePackageUninstallFailureBundle.VerifyRegisteredAndInPackageCache(); + arpEntryExePackage.VerifyRegistered(true); + packageTestExe.VerifyInstalled(true); + + Assert.True(LogVerifier.MessageInLogFile(uninstallLogPath, "TESTBA: OnCachePackageNonVitalValidationFailure() - id: TestExe, default: None, requested: Acquire")); + Assert.True(LogVerifier.MessageInLogFile(uninstallLogPath, $"testexe.exe\" /regd HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{arpId}")); + Assert.True(LogVerifier.MessageInLogFile(uninstallLogPath, $"TestExe.exe\" /regw \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{arpId},DisplayVersion,String,1.0.0.0\" /regw \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{arpId},QuietUninstallString,String,\\\"")); + } + [RuntimeFact] public void CanReinstallPerMachineArpEntryExePackageOnUninstallRollback() { @@ -142,6 +198,23 @@ public void CanUninstallPerMachineArpEntryExePackageOnInstallRollback() Assert.True(LogVerifier.MessageInLogFile(installLogPath, $"testexe.exe\" /regd HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{arpId}")); } + [RuntimeFact] + public void CanUninstallPerMachineDetectVersionExePackageOnInstallRollback() + { + var perMachineDetectVersionExePackageFailureBundle = this.CreateBundleInstaller(@"PerMachineDetectVersionExePackageFailure"); + var arpEntryExePackage = this.CreateArpEntryInstaller(perMachineDetectVersionExePackageFailureBundle, "TestExe"); + var arpId = arpEntryExePackage.ArpId; + + arpEntryExePackage.VerifyRegistered(false); + + var installLogPath = perMachineDetectVersionExePackageFailureBundle.Install((int)MSIExec.MSIExecReturnCode.ERROR_INSTALL_FAILURE); + perMachineDetectVersionExePackageFailureBundle.VerifyUnregisteredAndRemovedFromPackageCache(); + arpEntryExePackage.VerifyRegistered(false); + + Assert.True(LogVerifier.MessageInLogFile(installLogPath, $"TestExe.exe\" /regw \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{arpId},DisplayVersion,String,1.0.0.0\" /regw \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{arpId},QuietUninstallString,String,\\\"")); + Assert.True(LogVerifier.MessageInLogFile(installLogPath, $"testexe.exe\" /regd HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{arpId}")); + } + [RuntimeFact] public void CanUseLargeCustomExitCode() {