Skip to content

Commit

Permalink
Use registry startup and remove scheduled task
Browse files Browse the repository at this point in the history
  • Loading branch information
fahminlb33 committed Jun 27, 2020
1 parent dcf511b commit babde19
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
1 change: 1 addition & 0 deletions src/KFmaintenance.Setup/KFmaintenance.Setup.wixproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<Compile Include="Directory.wxs" />
<Compile Include="Files.wxs" />
<Compile Include="Product.wxs" />
<Compile Include="Registry.wxs" />
<Compile Include="Shortcuts.wxs" />
</ItemGroup>
<ItemGroup>
Expand Down
15 changes: 1 addition & 14 deletions src/KFmaintenance.Setup/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<Feature Id="ProductFeature" Title="KFmaintenance" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentGroupRef Id="AppShortcuts" />
<ComponentGroupRef Id="AppRegistry" />
</Feature>

<!-- Properties -->
Expand All @@ -38,28 +39,14 @@

<!-- Install Sequence -->
<InstallExecuteSequence>
<Custom Action="CreateScheduledTask" After="InstallFiles">NOT Installed</Custom>
<Custom Action="CreateFirewallExclusion" After="InstallFiles">NOT Installed</Custom>

<Custom Action="RemoveScheduledTask" After="InstallFiles">Installed</Custom>
<Custom Action="RemoveFirewallExclusion" After="InstallFiles">Installed</Custom>
</InstallExecuteSequence>
</Product>

<Fragment>
<!-- Launch App -->
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />

<!-- Scheduled Task -->
<SetProperty Id="CreateScheduledTask" Sequence="execute" Before="CreateScheduledTask"
Value="&quot;[SystemFolder]SCHTASKS.EXE&quot; /CREATE /TN &quot;KFmaintenance&quot; /TR &quot;[INSTALLFOLDER]\KFmaintenance.exe&quot; /SC ONSTART" />
<CustomAction Id="CreateScheduledTask" BinaryKey="WixCA" DllEntry="WixQuietExec"
Execute="deferred" Return="ignore" Impersonate="no"/>

<SetProperty Id="RemoveScheduledTask" Sequence="execute" Before="RemoveScheduledTask"
Value="&quot;[SystemFolder]SCHTASKS.EXE&quot; /DELETE /TN &quot;KFmaintenance&quot; /F" />
<CustomAction Id="RemoveScheduledTask" BinaryKey="WixCA" DllEntry="WixQuietExec"
Execute="deferred" Return="ignore" Impersonate="no"/>

<!-- Firewall Rules -->
<SetProperty Id="CreateFirewallExclusion" Sequence="execute" Before="CreateFirewallExclusion"
Expand Down
12 changes: 12 additions & 0 deletions src/KFmaintenance.Setup/Registry.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<ComponentGroup Id="AppRegistry">
<Component Id="AppStartup" Guid="{17082248-B0BE-4C16-93BD-44B8C9269D4C}" Directory="INSTALLFOLDER">
<RegistryKey Root="HKCU" Key="Software\Microsoft\Windows\CurrentVersion\Run" Action="createAndRemoveOnUninstall">
<RegistryValue Type="string" Name="KFmaintenance" Value="&quot;[#KFmaintenance.exe]&quot;" KeyPath="yes"/>
</RegistryKey>
</Component>
</ComponentGroup>
</Fragment>
</Wix>

0 comments on commit babde19

Please sign in to comment.