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)'
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)"/>
In my case I had issues with case sensitivity:
$(var.SomePrefix.MyProject.TargetPath)
did not work with the project named
"SomePrefix.Myproject"
It worked with a capital letter P in MyProject after renaming the project.
精彩评论