I've written a new installer using the WiX Toolset. It appears that the best practice is to use the heat.exe application to run through your built application files and auto-generate references for inclusion in your installer. This is great and all, but I find that by using this technique you pretty much block those files from being usefully in ANYTHING else except the act of copying them to the install directory. This is because I can't seem to "reference" these files for other things. For example. One of the files I would like to install as a service, but the ServiceInstall mechanism doesn't seem to let you use something referenced out of the harvest. Also, one of my files is an XML file that I would like to modify based on input from the user during install. Again, I can't seem to reference this file out of the harvest for use in the XmlConfig mechanism.
I've seen this post, but the chosen answer doesn't actually provide an example. And to boot, the WiX compiler does not let you put '#' symbols in the identifier field because it is "not a legal identifier" as the answer post claims. And if you use the plain IDs out of the harvest, it complains that they already exist.
Here is a snippet out my harvest .wxs file.
<!-- Xml file I'd like to modify during install -->
<Component Id="cmp78CF3591818BB6F883096F2C98654BA9" Guid="*">
<File Id="fil1532F0BC6EDCE81B25489D872A72339A" KeyPath="yes" Source="$(var.MyApplication.TargetDir)\log.config" />
</Component>
<!-- ... -->
<!-- Application I'd like to install as a service -->
<Component Id="cmp84F0EA671F93094E33AE84FA2A03BA2E" Guid="*">
<File Id="filD4A27A27D20D3D734B279B4F21754836" KeyPath="yes" Source="$(var.MyApplication.TargetDir)\MyService.exe" />
</Component>
For the service install, I feel like the intuitive way would be something like this:
<Component Id="cmp84F0EA671F93094E33AE84FA2A03BA2E">
<File Id="filD4A27A27D20D3D734B279B4F21754836" />
<ServiceInstall
Id="MyServiceID"
Name="MyService"
Type="ownProcess"
Start="auto"
ErrorControl="normal"
Interactive="no">
</ServiceInstall>
<ServiceControl Name="MyService" Id="MyServiceControl" Start="install" Stop="both" Remove="uninstall" Wait="yes"/>
</Component>
But of course this does not work because it claims the IDs are duplicated. Which I guess they are, but how can I say "You know that file 'X' inside the harvest... ya, I'd like to install that as a service." I have been able to get the install to work, but I had to filter MyService.exe out of the harvest and manually added it. Now if that is the case every time you'd actually like to do something with a particular file, then I think I may just forgot using the stupid heat.exe technique and manually input every file. So what exactly is the syntax that you would use to reference files from inside the heat.exe harvest?