How do I add a reference to a VSTO project to a Wi

2019-04-07 18:46发布

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.

1条回答
聊天终结者
2楼-- · 2019-04-07 19:39

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.

查看更多
登录 后发表回答