将外部DLL添加到WIX项目

时间:2013-03-26 17:45:38

标签: 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>

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

1 个答案:

答案 0 :(得分:5)

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

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