1) Register Search
<Property Id="INSTALLDIR">
<RegistrySearch Id='AcmeFoobarRegistry' Type='raw'
Root='HKLM' Key='Software\Acme\Foobar 1.0' Name='InstallDir' />
</Property>
2) ini file Search
<Property Id="INSTALLDIR">
<IniFileSearch Id='AcmeFoobarIniFile' Type='directory'
Name='SampleRegistry.ini' Section='Sample' Key='InstallDir' />
</Property>
3) Directory Search
<Property Id="FILEEXISTS">
<DirectorySearch Id="CheckFileDir" Path="[INSTALLDIR]" Depth="0">
<FileSearch Id="CheckFile" Name="Lookfor.txt" />
</DirectorySearch>
</Property>
4) Conditional Installation
<Property Id="FILEEXISTS">
<DirectorySearch Id="CheckFileDir" Path="[INSTALLDIR]" Depth="0">
<FileSearch Id="CheckFile" Name="Lookfor.txt" />
</DirectorySearch>
</Property>
<Feature Id='Documentation' Level='1'>
<ComponentRef Id='Manual' />
<Condition Level="1">FILEEXISTS</Condition>
</Feature>
5) Add Registry Key
To create a registry keys, include them inside a RegistryKey in the component
<RegistryKey Id='FoobarRegInstallDir' Root='HKLM' Key='Software\Acme\Foobar 1.0' Action='createAndRemoveOnUninstall'>
<RegistryValue Type='multiString' Name='InstallDir' Value='[TARGETDIR]'/>
<RegistryValue Type='multiString' Name='InstallDir' Value='[INSTALLDIR]' Action='append'/>
<RegistryValue Type='multiString' Name='InstallDir' Value='[ProgramFilesFolder] Action='append'/>
</RegistryKey>
Action:create , createAndRemoveOnUninstall
Type: can be string, integer, binary, expandable andmultistring.
6) Register our own file data type.
Put a ProgId inside your component. FileId should refer to theId attribute of theFile element describing the file meant to handle the files of this extension.
<ProgId Id='AcmeFoobar.xyzfile' Description='Acme Foobar data file'>
<Extension Id='xyz' ContentType='application/xyz'>
<Verb Id='open' Command='Open' TargetFile='FileId' Argument='"%1"' />
</Extension>
</ProgId>
To assign an icon to this file type, you have to specify where the icon should come from:
<ProgId Id='AcmeFoobar.xyzfile' Description='Acme Foobar data file' Icon='Foobar.ico'>
or, if the icon comes from an executable or resource file containing several icons, you can specify which one:
<ProgId Id='AcmeFoobar.xyzfile' Description='Acme Foobar data file' Icon='Foobar.exe' IconIndex='1'>
7) Write an .ini file
<IniFile Id="WriteIntoIniFile" Action="addLine" Key="InstallDir" Name="Foobar.ini"
Section="Paths" Value="[INSTALLDIR]" />
8) Remove file/folder created during functioning
<DirectoryRef Id="SDKDir">
<Directory Id='ConfigDir' Name='Config'>
<Component
Id='RemoveConfigFolderComponent'
Guid='BCF6AECA-16BA-4994-9722-7E2A910462A1'
Win64='yes'>
<!--Remove our cache files ect.-->
<RemoveFile Id='ConfigFiles' Name='*.*' On='uninstall'/>
<RemoveFolder Id='ConfigDir' On='uninstall'/>
</Component>
</Directory>
<Component
Id='RemoveFolderComponent'
Guid='76422AD9-71FD-49ed-BEB3-2624F84E0A77'
Win64='yes'>
<RemoveFolder Id='SDKDir' On='uninstall'/>
</Component>
</DirectoryRef>
On: install, uninstall and both.
The Name can contain wildcard characters, too. The file or files should be located in the same folder as the component itself
9) Add icon that will be displayed in Program and Feature to our application.
<Icon Id='ProductIcon' SourceFile='Resource\ico.ico'/>
<Property Id="ARPPRODUCTICON" Value="ProductIcon" />