remove previous version upon upgrade

fix link to documentation
This commit is contained in:
Enrico Giordani
2019-09-13 13:35:46 +02:00
committed by Enrico Giordani
parent 7eedda30db
commit 390ad0561f
2 changed files with 10 additions and 5 deletions

View File

@@ -14,6 +14,14 @@
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated" Platform="x64" /> <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated" Platform="x64" />
<MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed." /> <MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed." />
<Upgrade Id="42B84BF7-5FBF-473B-9C8B-049DC16F7708">
<UpgradeVersion
Minimum="0.11.0" Maximum="0.11.0"
Property="PREVIOUSVERSIONSINSTALLED"
IncludeMinimum="yes" IncludeMaximum="yes" />
</Upgrade>
<MediaTemplate EmbedCab="yes" /> <MediaTemplate EmbedCab="yes" />
<Property Id="WINDOWSBUILDNUMBER" Secure="yes"> <Property Id="WINDOWSBUILDNUMBER" Secure="yes">
@@ -60,9 +68,7 @@
NOT Installed and CREATESCHEDULEDTASK = 1 NOT Installed and CREATESCHEDULEDTASK = 1
</Custom> </Custom>
<Custom Action="WixCloseApplications" Before="RemoveFiles" /> <Custom Action="WixCloseApplications" Before="RemoveFiles" />
<Custom Action="RemovePowerToysSchTasks" After="RemoveFiles"> <Custom Action="RemovePowerToysSchTasks" After="RemoveFiles" />
Installed and (NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")
</Custom>
<Custom Action="TelemetryLogInstallSuccess" After="InstallFinalize"> <Custom Action="TelemetryLogInstallSuccess" After="InstallFinalize">
NOT Installed NOT Installed
</Custom> </Custom>
@@ -84,7 +90,6 @@
DllEntry="CreateScheduledTaskCA" DllEntry="CreateScheduledTaskCA"
/> />
<!-- Needs to Impersonate="no" and Execute="deferred" in order to run elevated. -->
<CustomAction Id="RemovePowerToysSchTasks" <CustomAction Id="RemovePowerToysSchTasks"
Return="ignore" Return="ignore"
Impersonate="no" Impersonate="no"

View File

@@ -29,7 +29,7 @@ const DWORD USERNAME_LEN = UNLEN + 1; // User Name + '\0'
// Creates a Scheduled Task to run at logon for the current user. // Creates a Scheduled Task to run at logon for the current user.
// The path of the executable to run should be passed as the CustomActionData (Value). // The path of the executable to run should be passed as the CustomActionData (Value).
// Based on the Task Scheduler Logon Trigger Example: // Based on the Task Scheduler Logon Trigger Example:
// https://docs.microsoft.com/en-us/windows/desktop/taskschd/logon-trigger-example--c---/ // https://docs.microsoft.com/en-us/windows/win32/taskschd/logon-trigger-example--c---/
UINT __stdcall CreateScheduledTaskCA(MSIHANDLE hInstall) { UINT __stdcall CreateScheduledTaskCA(MSIHANDLE hInstall) {
HRESULT hr = S_OK; HRESULT hr = S_OK;
UINT er = ERROR_SUCCESS; UINT er = ERROR_SUCCESS;