Skip to content

Commit 940e753

Browse files
committed
Add WiX installer project and build scripts
1 parent a98c1e1 commit 940e753

File tree

7 files changed

+303
-0
lines changed

7 files changed

+303
-0
lines changed

SecondaryClick.slnx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<Solution>
22
<Project Path="src/SecondaryClick/SecondaryClick.csproj" />
3+
<Configurations>
4+
<Platform Name="Any CPU" />
5+
<Platform Name="x86" />
6+
</Configurations>
7+
<Project Path="src/SecondaryClick.Installer/SecondaryClick.Installer.wixproj" Id="f0214fc2-efbe-426c-842d-b42bc37d9525">
8+
<Platform Project="x86" />
9+
<Build />
10+
</Project>
311
<Project Path="src/SecondaryClick.MouseKeyHook/SecondaryClick.MouseKeyHook.csproj" />
412
<Project Path="src/SecondaryClick.WindowsInput/SecondaryClick.WindowsInput.csproj" />
513
</Solution>

build/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
*.zip
44
*.exe
55
*.msi
6+
*.wixpdb
7+

build/rename-msi.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
$version = git -C "$PSScriptRoot\.." describe --always --tags --exclude latest
2+
3+
if (Test-Path "$PSScriptRoot\SecondaryClick.msi") {
4+
Remove-Item "$PSScriptRoot\SecondaryClick-$version.msi" -ErrorAction SilentlyContinue
5+
Rename-Item "$PSScriptRoot\SecondaryClick.msi" "SecondaryClick-$version.msi"
6+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
3+
<Fragment>
4+
<DirectoryRef Id="INSTALLFOLDER" />
5+
</Fragment>
6+
<Fragment>
7+
<ComponentGroup Id="SecondaryClickComponents">
8+
<Component Id="cmpD19802B06115E097B82E6F79408558EF" Directory="INSTALLFOLDER" Guid="47BDE558-3271-4744-B666-39A0A7B73E60">
9+
<File Id="fil978DECC154F6EDA86754D7F9EA76EAB4" KeyPath="yes" Source="$(var.PackageDir)\ClearRegistry.bat" />
10+
</Component>
11+
<Component Id="cmpFD4AAFCE6CF156B546A89AAB6C625E9E" Directory="INSTALLFOLDER" Guid="500C4481-D4F4-4C33-A9D4-FA1933D33C4B">
12+
<File Id="fil5C0FC61BF17FC93AA827C79BE98103F9" KeyPath="yes" Source="$(var.PackageDir)\ExitProgram.bat" />
13+
</Component>
14+
<Component Id="cmpA33705521F2F2AEF738C77A6F1ECF3F2" Directory="INSTALLFOLDER" Guid="9A5B235D-CAEC-48E2-B781-ABD96716BB17">
15+
<File Id="fil56DAD60E70E0A9998E514FC7477738DF" KeyPath="yes" Source="$(var.PackageDir)\RestoreTrayIcon.bat" />
16+
</Component>
17+
<Component Id="cmpEE7B57D3B03BA030B5B9FEF1EF3B0EE8" Directory="INSTALLFOLDER" Guid="BBCCC138-A74D-4F6F-AFA8-6C822D5DC4DE">
18+
<File Id="fil1F73E7948DC0DAC391A5407778FA4FC5" KeyPath="yes" Source="$(var.PackageDir)\SecondaryClick.exe" />
19+
</Component>
20+
<Component Id="cmpC3307578820D1E602DBB8632C1B03CF2" Directory="INSTALLFOLDER" Guid="98D38F4E-774D-46C7-9058-37DF4CE56DE0">
21+
<File Id="fil4D52B2CFB8EEFC2EC0FB781DD03C7A79" KeyPath="yes" Source="$(var.PackageDir)\SecondaryClick.exe.config" />
22+
</Component>
23+
</ComponentGroup>
24+
</Fragment>
25+
</Wix>
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
4+
<Product Id="*" Name="SecondaryClick" Language="1033"
5+
Version="!(bind.FileVersion.fil1F73E7948DC0DAC391A5407778FA4FC5)" Manufacturer="QL-Win"
6+
UpgradeCode="c83b9c02-87d6-494e-9f5f-cf4c3900a54d">
7+
<Package InstallerVersion="500" Compressed="yes" Platform="x86" InstallScope="perUser" />
8+
9+
<MajorUpgrade Schedule="afterInstallValidate" AllowDowngrades="yes" />
10+
<MediaTemplate EmbedCab="yes" CompressionLevel="low" />
11+
12+
<Property Id='ALLUSERS' Value='2' />
13+
<Property Id='MSIINSTALLPERUSER' Value='1' />
14+
15+
<WixVariable Id="WixUILicenseRtf" Value="gpl.rtf" />
16+
17+
<Feature Id="ProductFeature" Title="SecondaryClick.Installer" Level="1">
18+
<ComponentGroupRef Id="SecondaryClickComponents" />
19+
<ComponentRef Id="ApplicationShortcutDesktop" />
20+
<ComponentRef Id="ApplicationShortcutProgramMenu" />
21+
</Feature>
22+
23+
<Directory Id="TARGETDIR" Name="SourceDir">
24+
<Directory Id="ProgramMenuFolder">
25+
<Component Id="ApplicationShortcutProgramMenu" Guid="4F3E84DA-0E8B-44E9-B59D-B3AFAE70519E">
26+
<Shortcut Id="ApplicationProgramMenuShortcut"
27+
Name="SecondaryClick"
28+
Description="SecondaryClick lets you perform a secondary click using modifier keys."
29+
Target="[INSTALLFOLDER]SecondaryClick.exe"
30+
WorkingDirectory="INSTALLFOLDER" />
31+
<RemoveFolder Id="ProgramMenuFolder" On="uninstall" />
32+
<RegistryValue
33+
Root="HKCU"
34+
Key="Software\SecondaryClick"
35+
Name="installed"
36+
Type="integer"
37+
Value="1"
38+
KeyPath="yes" />
39+
</Component>
40+
</Directory>
41+
<Directory Id="DesktopFolder" Name="Desktop">
42+
<Component Id="ApplicationShortcutDesktop" Guid="9ECBF18A-F3C7-495A-9327-02A2E79ABBD7">
43+
<Shortcut Id="ApplicationDesktopShortcut"
44+
Name="SecondaryClick"
45+
Description="SecondaryClick lets you perform a secondary click using modifier keys."
46+
Target="[INSTALLFOLDER]SecondaryClick.exe"
47+
WorkingDirectory="INSTALLFOLDER" />
48+
<RemoveFolder Id="DesktopFolder" On="uninstall" />
49+
<RegistryValue
50+
Root="HKCU"
51+
Key="Software\SecondaryClick"
52+
Name="installed"
53+
Type="integer"
54+
Value="1"
55+
KeyPath="yes" />
56+
</Component>
57+
</Directory>
58+
<Directory Id="ProgramFilesFolder">
59+
<Directory Id="INSTALLFOLDER" Name="SecondaryClick" />
60+
</Directory>
61+
</Directory>
62+
63+
<CustomAction Id="LaunchApplication"
64+
FileKey="fil1F73E7948DC0DAC391A5407778FA4FC5"
65+
ExeCommand="/first"
66+
Execute="immediate"
67+
Impersonate="yes"
68+
Return="asyncNoWait" />
69+
70+
<UI>
71+
<UIRef Id="WixUI_InstallDir" />
72+
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
73+
74+
<Publish Dialog="ExitDialog" Control="Finish" Order="1" Event="DoAction" Value="LaunchApplication">NOT Installed</Publish>
75+
</UI>
76+
</Product>
77+
</Wix>
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
6+
<ProductVersion>3.14</ProductVersion>
7+
<ProjectGuid>f0214fc2-efbe-426c-842d-b42bc37d9525</ProjectGuid>
8+
<SchemaVersion>2.0</SchemaVersion>
9+
<OutputName>SecondaryClick</OutputName>
10+
<OutputType>Package</OutputType>
11+
<OutputPath>..\..\build\</OutputPath>
12+
<LangVersion>latest</LangVersion>
13+
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
14+
<PackageDir>$(MSBuildThisFileDirectory)..\SecondaryClick\bin\$(Configuration)\net48</PackageDir>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
17+
<DefineConstants>Debug;PackageDir=$(PackageDir)</DefineConstants>
18+
<SuppressPdbOutput>True</SuppressPdbOutput>
19+
</PropertyGroup>
20+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
21+
<DefineConstants>PackageDir=$(PackageDir)</DefineConstants>
22+
</PropertyGroup>
23+
<ItemGroup>
24+
<Compile Include="C_SecondaryClickComponents.wxs" />
25+
<Compile Include="Product.wxs" />
26+
</ItemGroup>
27+
<ItemGroup>
28+
<WixExtension Include="WixUIExtension">
29+
<HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath>
30+
<Name>WixUIExtension</Name>
31+
</WixExtension>
32+
</ItemGroup>
33+
<ItemGroup>
34+
<Content Include="gpl.rtf" />
35+
</ItemGroup>
36+
<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
37+
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets') " />
38+
<Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
39+
<Error Text="The WiX Toolset v3.14 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
40+
</Target>
41+
<PropertyGroup>
42+
<PostBuildEvent>powershell -ExecutionPolicy Bypass -file "$(MSBuildThisFileDirectory)..\..\build\rename-msi.ps1"</PostBuildEvent>
43+
</PropertyGroup>
44+
<PropertyGroup>
45+
<PreBuildEvent>if not exist "$(PackageDir)" (
46+
echo ERROR: Package directory not found: "$(PackageDir)"
47+
exit /b 1
48+
)
49+
50+
"$(WIX)bin\heat" dir "$(PackageDir)" -dr INSTALLFOLDER -cg SecondaryClickComponents -gg -g1 -sf -srd -sreg -var "var.PackageDir" -out "$(ProjectDir)C_SecondaryClickComponents.wxs"</PreBuildEvent>
51+
</PropertyGroup>
52+
<!--
53+
To modify your build process, add your task inside one of the targets below and uncomment it.
54+
Other similar extension points exist, see Wix.targets.
55+
<Target Name="BeforeBuild">
56+
</Target>
57+
<Target Name="AfterBuild">
58+
</Target>
59+
-->
60+
</Project>

0 commit comments

Comments
 (0)