Stephen Jennings
Stephen Jennings

Reputation: 13254

Can WiX reference a project with a period in the name?

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:

The build error I get is:

Undefined preprocessor variable '$(var.My.Project.TargetPath)'

Upvotes: 13

Views: 4945

Answers (3)

Alex
Alex

Reputation: 5439

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.

Upvotes: 0

Christopher Painter
Christopher Painter

Reputation: 55601

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)"/>

Upvotes: 8

Stephen Jennings
Stephen Jennings

Reputation: 13254

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.

Upvotes: 17

Related Questions