1+ <Wix xmlns =" http://wixtoolset.org/schemas/v4/wxs" >
2+ <Package Name =" Git-Xet"
3+ Manufacturer =" Hugging Face"
4+ Version =" 0.1.0"
5+ Language =" 1033"
6+ UpgradeCode =" 1aedaf4a-9b02-44e5-be42-ef18ce3b5c28" >
7+
8+ <!-- This tag ensures all installation files are compressed into a single .msi file. -->
9+ <MediaTemplate EmbedCab =" yes" />
10+
11+ <MajorUpgrade DowngradeErrorMessage =" A newer version of [ProductName] is already installed." />
12+
13+ <!-- Define the directory structure. -->
14+ <StandardDirectory Id =" ProgramFiles64Folder" >
15+ <Directory Id =" INSTALLFOLDER" Name =" Git-Xet" />
16+ </StandardDirectory >
17+
18+ <!--
19+ This is the Feature tree. We have one main feature.
20+ It contains the ComponentGroup we define below.
21+ -->
22+ <Feature Id =" Main" Title =" Main Feature" Level =" 1" >
23+ <ComponentGroupRef Id =" AppComponents" />
24+ <ComponentRef Id =" UpdateSystemPath" />
25+ </Feature >
26+
27+ <!--
28+ Component Group for our application files.
29+ -->
30+ <ComponentGroup Id =" AppComponents" Directory =" INSTALLFOLDER" >
31+ <Component Id =" MyAppExeComponent" Guid =" 0eaa2c4c-3512-4c0f-975f-7bcd1394f315" >
32+ <File Id =" GitXet" Source =" git-xet.exe" KeyPath =" yes" Checksum =" yes" />
33+ </Component >
34+ </ComponentGroup >
35+
36+ <!--
37+ This component modifies the system PATH environment variable.
38+ -->
39+ <Component Id =" UpdateSystemPath" Directory =" INSTALLFOLDER" Guid =" 74890476-4e17-4f81-891b-e0251380bfcb" >
40+ <!--
41+ - Name='Path': Specifies we're modifying the PATH variable.
42+ - Action='set': We are setting a value.
43+ - Value='[INSTALLFOLDER]': The value to add, which is the installation directory.
44+ - Part='last': Appends our directory to the end of the existing PATH.
45+ - System='yes': Modifies the system-wide PATH, not just the user's.
46+ -->
47+ <Environment Id =" PATH" Name =" Path" Value =" [INSTALLFOLDER]" Part =" last" Action =" set" System =" yes" />
48+
49+ <!-- Every component needs a KeyPath. We create a dummy registry key for this non-file component. -->
50+ <RegistryValue Root =" HKCU" Key =" Software\[Manufacturer]\[ProductName]" Name =" PathAdded" Type =" integer" Value =" 1" KeyPath =" yes" />
51+ </Component >
52+
53+ <!--
54+ Define the Custom Action to run the install command.
55+ - Execute="immediate": The action will run during normal processing time with user privileges.
56+ - Return="check": The installer will check the exit code and roll back if it fails.
57+ -->
58+ <CustomAction Id =" RunInstallCommand"
59+ FileRef =" GitXet"
60+ ExeCommand =" install --concurrency 3"
61+ Execute =" immediate"
62+ Return =" check"
63+ Impersonate =" yes" />
64+
65+ <!--
66+ Define the Custom Action to run the uninstall command.
67+ - Execute="immediate": The action will run during normal processing time with user privileges.
68+ - Return="check": The installer will check the exit code and roll back if it fails.
69+ -->
70+ <CustomAction Id =" RunUninstallCommand"
71+ FileRef =" GitXet"
72+ ExeCommand =" uninstall --all"
73+ Execute =" immediate"
74+ Return =" check"
75+ Impersonate =" yes" />
76+
77+ <!--
78+ Schedule the Custom Action in the installation sequence.
79+ -->
80+ <InstallExecuteSequence >
81+ <!--
82+ - Action="RunInstallCommand": The ID of the Custom Action we defined above.
83+ - After="InstallFinalize": Schedules the action to run late in the sequence, after all files and registry keys are in place.
84+ - Condition="NOT Installed": This condition ensures the action only runs during the initial installation, not during an uninstall or repair.
85+ -->
86+ <Custom Action =" RunInstallCommand" After =" InstallFinalize" Condition =" NOT Installed" />
87+
88+ <!--
89+ - Action="RunUninstallCommand": The ID of the Custom Action we defined above.
90+ - Before="RemoveFiles": Runs the command before the .exe is deleted from the disk.
91+ - Condition='REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE': Ensures this only runs on a clean uninstall, not during an upgrade.
92+ -->
93+ <Custom Action =" RunUninstallCommand" Before =" RemoveFiles" Condition =' REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE' />
94+ </InstallExecuteSequence >
95+
96+ </Package >
97+ </Wix >
0 commit comments