如何将 VSTO 项目的引用添加到 Visual Studio 2010 中的 WiX 安装程序项目? [英] How do I add a reference to a VSTO project to a WiX Installer project in Visual Studio 2010?

查看:35
本文介绍了如何将 VSTO 项目的引用添加到 Visual Studio 2010 中的 WiX 安装程序项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含 VSTO 插件项目的 Visual Studio 2010 解决方案.我还在解决方案中添加了一个 WiX 安装项目,现在我需要在安装项目中添加对 VSTO 项目的引用,但我无法这样做.当我右键单击 WiX 设置项目中的引用,然后选择添加引用,然后选择项目选项卡时,VSTO 项目没有出现在可供引用的可用项目列表中.

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.

推荐答案

我遇到了同样的问题,然后我尝试做错了":我添加了手动编辑 .wixproj 文件的参考.

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>

显然,您必须替换项目的路径和项目 GUID(在程序集信息中找到).

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

当您在 Visual Studio 中重新加载项目(我使用 2012,但我想它会是一样的)时,您会看到带有警告图标的引用.

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.

您仍然设法将变量用作 $(var.MyExcelAddin.TargetDir).

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

希望这会有所帮助.

这篇关于如何将 VSTO 项目的引用添加到 Visual Studio 2010 中的 WiX 安装程序项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆