c# - 将外部 DLL 添加到 WIX 项目

标签 c# visual-studio-2012 wix windows-installer wix3

我正在尝试在 VS 2012 中使用 Wix 构建安装,但我无法添加“外部”引用

我有我的项目 FirmwareUpload,这是我想安装的东西,引用了我们公司的框架。和 FirmwareUploadSetup,这是我的安装程序项目。我在这个项目中添加了对我的其他项目的引用并创建了 XML:

<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
  <Component Id="MainEXE">
    <!-- TODO: Insert files, registry keys, and other resources here. -->
    <File Source="$(var.FirmwareUpload.TargetPath)">
      <Shortcut Id="startmenuFWU10" Directory="ProgramMenuDir" Name="Firmware Upload 1.0"
                WorkingDirectory="INSTALLDIR" Advertise="yes" />
      <Shortcut Id="desktopFWU10" Directory="DesktopFolder" Name="Firmware Upload 1.0"
                WorkingDirectory="INSTALLDIR" Advertise="yes" />
    </File>

  </Component>
  <Component Id="AstuFMS">
    <File Source="$(var.Astus.FMS.TargetPath)" Name="Astus.FMS.dll" ShortName="AF" />
  </Component>
  <Component Id="AstusServerBusinessLogic">
    <File Source="$(var.Astus.Server.BusinessLogic.TargetPath)" Name="Astus.Server.BusinessLogic.dll"
          ShortName="ASBL" />
  </Component>
  <Component Id="ETL">
    <File Source="$(var.ETLElectronique.TargetPath)" />
  </Component>
  <Component Id="ETLBusiness">
    <File Source="$(var.ETLElectronique.Business.TargetPath)" Name="ETLElectronique.Business.dll" ShortName="EB" />
  </Component>
  <Component Id="ETLCommon">
    <File Source="$(var.ETLElectronique.Common.TargetPath)" Name="ETLElectronique.Common.dll" ShortName="EC" />
  </Component>
  <Component Id="ETLData">
    <File Source="$(var.ETLElectronique.Data.TargetPath)" Name="ETLElectronique.Data.dll" ShortName="ED" />
  </Component>
  <Component Id="ETLNet">
    <File Source="$(var.ETLElectronique.Net.TargetPath)" Name="ETLElectronique.Net.dll" ShortName="EN" />
  </Component>
  <Component Id="ETLWindows">
    <File Source="$(var.ETLElectronique.Windows.TargetPath)" Name="ETLElectronique.Windows.dll" ShortName="EW" />
  </Component>
</ComponentGroup>

这行得通!!当我执行安装程序时,我在我的目录中得到了这些文件。但是软件运行还需要其他文件(例如:log4net.dll)

当我编译我的“FirmwareUpload”项目时,我得到了 log4net.dll(以及许多其他的)。所以我需要在我的安装中安装这些 DLL,以便程序在安装后运行。

边做边做:

 <ComponentGroup Id="DocumentationComponents" Directory="INSTALLFOLDER" Source="C:\fms\hotfix\v42x\V6\Utilitaire\FirmwareUpload\FirmwareUpload\bin\Debug">
      <Component Id="log4net">
        <File Name="log4net.dll" />
      </Component>
      <Component Id="Astus.Device.Configuration">
        <File Name="Astus.Device.Configuration.dll" />
      </Component>
      <Component Id="Astus.Device">
        <File Name="Astus.Device.dll" />
      </Component>
      <Component Id="Microsoft.Practices.EnterpriseLibrary.Common">
        <File Name="Microsoft.Practices.EnterpriseLibrary.Common.dll" />
      </Component>
      <Component Id="Microsoft.Practices.EnterpriseLibrary.Data">
        <File Name="Microsoft.Practices.EnterpriseLibrary.Data.dll" />
      </Component>
      <Component Id="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling">
        <File Name="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll" />
      </Component>
      <Component Id="Microsoft.Practices.ObjectBuilder">
        <File Name="Microsoft.Practices.ObjectBuilder.dll" />
      </Component>
    </ComponentGroup>

但是有没有更“硬编码”的方式呢?

最佳答案

您可以使用 heat(“收获工具”)扫描文件夹并生成将文件包含在该文件夹中所需的 xml。

参见 http://wix.sourceforge.net/manual-wix3/heat.htm

关于c# - 将外部 DLL 添加到 WIX 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15643960/

相关文章:

windows - 使用 Platform 属性构建 WiX x86/x64

c# - 在服务器上发布我的 Core 2.2 项目后 web.config 无效

c# - 如何在代码中使用 wsDualHttpBinding 设置 WCF 客户端?

c# - DateTime now = DateTime.Now; 是什么意思?在 C# 中做什么?

visual-c++ - 使用 v110_xp : "cannot open file ' , 5.0 1'"时出现链接器错误

asp.net-mvc-4 - CSS Intellisense 不适用于 Visual Studio 2012 Ultimate 中的 MVC 4 项目

c# - 在应用程序安装时停止 SQL Server 服务

c# - List<T> 到字典

visual-studio-2012 - WinJS System.Launcher 仅在 Debug模式下工作

c# - WiX:在卸载时正确删除非空的临时文件和文件夹