WiX files can reference other projects using $(var.ProjectName.TargetPath)
syntax. However, I have a project with a period in the name (My.Project). How can I reference this? I have tried:
$(var.My.Project.TargetPath)
$(var.My.Project.TargetPath)
$(var.My\.Project.TargetPath)
$(var.{My.Project}.TargetPath)
$(var.(My.Project).TargetPath)
$(var.[My.Project].TargetPath)
$(var.MyProject.TargetPath)
$(var.My%2EProject.TargetPath)
The build error I get is:
Undefined preprocessor variable '$(var.My.Project.TargetPath)'
TargetDIR is the directory in which the files are installed. It is a required parameter for the element. The value of TargetDIR is resolved to an absolute path during installation. If TargetDIR is not specified, the default is the directory of the component.
You can also right-click the project node and select Add > Project Reference. If you see a References node in Solution Explorer, you can use the right-click context menu to choose Add Reference. Or, right-click the project node and select Add > Reference. For more information, see How to: Add or remove references.
The answer is yes, and the method is:
$(var.My.Project.TargetPath)
As it turns out, I'm a dope who forgets to add project references to his installer project.
I'm sorry, I'm using WiX 3.5 and I can't reproduct your problem. I created a sample solution with a class library called "Foo.Bar" and a Merge Module with a project reference for "Foo.Bar".
My wixproj looks like:
<ItemGroup>
<ProjectReference Include="..\Foo.Bar\Foo.Bar.csproj">
<Name>Foo.Bar</Name>
<Project>{0bd367ce-5072-4161-8447-ff4deed97bd4}</Project>
<Private>True</Private>
<DoNotHarvest>True</DoNotHarvest>
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
<RefTargetDir>INSTALLLOCATION</RefTargetDir>
</ProjectReference>
</ItemGroup>
My wxs looks like:
<Binary Id="TEST" SourceFile="$(var.Foo.Bar.TargetPath)"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With