I'm trying to create a shortcut on the program files menu for my application. However, as my company may have a number of products with their own installers I want to have them in sub folders on the menu where each installer add its products shortcuts to this submenu.
So far I have achieved this but when I uninstall one it leaves its artefacts behind on the startup menu, and if I uninstall all of them it still leaves behind the Company Folder as well as any failed sub menus.
Heres a section of the WIX code which I was attempting to use. I'm using the same code in multiple installers for the different products:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name ="PFiles">
<Directory Id="CompanyFolder" Name="!(loc.ManufacturerName)">
<Directory Id="INSTALLDIR" Name="!(loc.ProductName)"/>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="CompanyProgramsFolder" Name="!(loc.ManufacturerName)">
<Directory Id="ProductFolder" Name="!(loc.ProductName)"/>
</Directory>
</Directory>
</Directory>
<DirectoryRef Id="CompanyProgramsFolder">
<Component Id="CompanyProgramsFolderComponent" Guid="{SOME GUID}" >
<RegistryValue Root="HKCU" Key="Software\!(loc.ManufacturerName)" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
<RemoveFolder Id="CompanyProgramsFolder" On="uninstall"/>
</Component>
</DirectoryRef>
<DirectoryRef Id="ProductFolder">
<Component Id="ApplicationShortcut" Guid="SOME GUID">
<Shortcut Id="ApplicationStartMenuShortcut" Icon="Company.ico" Name="!(loc.ProductName)" Description="!(loc.ApplicationDescription)" Target="[INSTALLDIR]MyApplication.exe" WorkingDirectory="INSTALLDIR"/>
<Shortcut Id="UninstallProduct" Icon="Company.ico" Name="Uninstall !(loc.ProductName)" Description="Uninstalls !(loc.ProductName)"
Target="[SystemFolder]msiexec.exe"
Arguments="/x [ProductCode]"/>
<RemoveFolder Id="ProductFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\!(loc.ManufacturerName)\!(loc.ProductName)" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<!-- Set the components defined in our fragment files that will be used for our feature -->
<Feature Id="MainFeature" Title="!(loc.ProductName)" Description="!(loc.ApplicationDescription)" Level="1">
<ComponentGroupRef Id="Files" />
<ComponentRef Id="CompanyProgramsFolderComponent" />
<ComponentRef Id="ApplicationShortcut" />
</Feature>
Is there a way to get this to work? I'm not to comfortable with what functionality the Registry values are playing here so I may have been naive with my use of them.