4

我正在尝试在 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>

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

4

1 回答 1

5

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

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

于 2013-03-26T18:05:21.387 回答