Advanced Harvesting generates unique identifiers for all harvested resources to prevent identity collisions in the MSI package. While these identifiers are stable, they are not human readable. For most harvested files this is acceptable. However, it is often necessary to reference the primary output of a project, for example to point a shortcut at the executable built by a project.
Fortunately, it is common MSBuild convention for project targets to define a "key output file". As you would expect, .csproj and .vcxproj files define the key file as the .dll or .exe built by the project. Advanced Harvesting allows you identify that file with the KeyIdentifier
attribute on the <HarvestProject/>
.
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:fg="http://www.firegiant.com/schemas/v3/wxs/fgwep.xsd">
<Fragment>
<ComponentGroup Id="ConsoleAppComponents">
<Component Directory="INSTALLFOLDER">
<fg:HarvestProject Name="ConsoleApplication1"
KeyIdentifier="MyConsoleApp"
OutputGroup="BuiltProjectOutputGroup;BuiltProjectOutputGroupDependencies" />
</Component>
<Component>
<RegistryValue Key="HKLM"
Path="SOFTWARE\Company\Product"
Name="ExePath"
Value="[!MyConsoleApp]"
Type="string" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>