Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add a reference to a VSTO project to a WiX Installer project in Visual Studio 2010?

I've got a Visual Studio 2010 solution which contains a VSTO Add-In project. I've also added a WiX Setup project to the solution, and I now need to add a reference to VSTO project in the Setup project, but am unable to do so. When I right click the References in the WiX Setup project, then select Add Reference, then Select the Projects tab the VSTO project doesn't appear in the list of available projects to reference.

like image 581
Russ Clark Avatar asked Dec 12 '12 16:12

Russ Clark


People also ask

How do I create an MSI File with WiX?

In Visual Studio, open your solution, and add a WiX project to it: go to the Visual Studio main menu and click File -> Add -> New Project to open the Add New Project dialog. Choose the Setup Project item in the Windows Installer XML node, specify the project name and click OK.

What is WiX Visual Studio?

The Visual Studio WiX toolset allows you to easily create WiX projects, edit WiX files using IntelliSense, and compile/link your project within the Visual Studio IDE. For WiX project types, see WiX Project Types. For WiX item templates, see WiX Item templates.


1 Answers

I had the same problem, then I tried to "do it wrong": I added the reference editing the .wixproj file manually.

I just had to add the following snippet:

<ItemGroup>
<ProjectReference Include="..\MyExcelAddin\MyExcelAddin.csproj">
<Name>MyExcelAddin</Name>
  <Project>{2b1d7a7b-4928-45fa-bfdf-cd7d435eecfc}</Project>
  <Private>True</Private>
  <DoNotHarvest>
  </DoNotHarvest>
  <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
  <RefTargetDir>INSTALLFOLDER</RefTargetDir>
  </ProjectReference>
</ItemGroup>

Obviously you have to replace the path to your project and the project GUID (found in the assembly informations).

When you reload the project in Visual Studio (I use 2012 but I guess it'll be the same) you see the reference with a warning icon.

You still manage to use variables as $(var.MyExcelAddin.TargetDir) though.

Hope this helps.

like image 78
p4bl0 Avatar answered Oct 13 '22 00:10

p4bl0