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

1

6

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.

Occidentalize answered 12/12, 2012 at 16:35 Comment(2)
I have the same issue -- all the other projects in the solution show up -- but not the VSTO add-in. Very strange.Friesen
this has been reported to wix bug list: wixtoolset.org/issues/4337Hussar
D
2

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.

Diphase answered 29/4, 2013 at 13:16 Comment(2)
This helps to add my Excel Add-in as a reference, but unfortunately the generated msi doesnt run the install process when double clicked (even after following this line for line:wixtoolset.org/documentation/manual/v3/votive/… )Hussar
from what I see in that page there is a lot missing: you need to add (manually) to your WiX file all files generated from the build of your excel add-in (.dll, .manifest, .vsto, and all other dlls). In order to make your add-in "loadable" by Excel, you have also to add a registry key inside the .vsto component adding the key Software\Microsoft\Office\Excel\Addins\MyExcelAddin (with your name of course) with 4 values: Description, FriendlyName, LoadBehavior (with value 3) and Manifest (with value file:///[#MyExcelAddin.vsto]|vstolocal).Diphase

© 2022 - 2024 — McMap. All rights reserved.