1

我正在尝试使用 WIX 创建一个(希望如此)简单的安装程序,但似乎我无能为力。我一生都无法弄清楚如何指定预定义的路径来安装我的文件。安装程序需要做的是:

  1. 安装 4 种字体
  2. 将二进制文件和 .ini 文件安装(复制)到预定义路径(“C:\dvimport”)
  3. 在桌面上创建上一个二进制文件的快捷方式
  4. 运行安装程序附带(希望捆绑在内部)提供的二进制安装程序。

另外,在旁注中;用户应该能够更改预定义的路径,因为如果没有安装在正确的路径上,应用程序将无法运行。

目前我所拥有的是这个(主要是预定义的):

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="660d9ab6-dbd9-4440-b56b-8f1c29d9ab86" Name="FDVweb hjelpefiler" Language="1033" Version="1.0.0.0" Manufacturer="CuroTech" UpgradeCode="4283b7c8-0057-4dcc-bfc5-7c06a12cba90">
    <Package InstallerVersion="200" Compressed="yes" Keywords="Installer" Description="FDVweb hjelpefiler installasjons-program" />

    <Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />

    <Binary Id="BarCodeDriver" SourceFile="barcode_install.exe" />
    <CustomAction Id="InstallBarCodeDriver" BinaryKey="BarCodeDriver" ExeCommand="" Execute="deferred" Return="check" HideTarget="no" Impersonate="no" />

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLLOCATION" Name="FDVweb">
          <!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
          <!-- <Component Id="ProductComponent" Guid="55a9465e-2350-48bc-9786-22a036ea7304"> -->
            <!-- TODO: Insert files, registry keys, and other resources here. -->
          <!-- </Component> -->
        </Directory>
      </Directory>

    </Directory>

    <DirectoryRef Id="FontsFolder">
      <Component Id="C128_100" Guid="72E7E1D2-DEE7-4E0B-939F-5460AD432BEF">
        <File Id="C128_100.tff" Source="fonts\C128_100.tff" TrueType="yes" />
      </Component>
      <Component Id="C128_200" Guid="230EE8B3-06F9-4D88-AFF5-3D26AF0741AD">
        <File Id="C128_200.tff" Source="fonts\C128_200.tff" TrueType="yes" />
      </Component>
      <Component Id="C128_300" Guid="3DC98EE5-B969-453E-B4E9-5D5BC1416F24">
        <File Id="C128_300.tff" Source="fonts\C128_300.tff" TrueType="yes" />
      </Component>
      <Component Id="C128_400" Guid="8CFCAFBE-C7B8-46F1-9C6D-ACF2D881BAEE">
        <File Id="C128_400.tff" Source="fonts\C128_400.tff" TrueType="yes" />
      </Component>
    </DirectoryRef>

    <Feature Id="Complete" Title="FDVwebInstall" Level="1">
      <!-- TODO: Remove the comments around this ComponentRef element and the Component above in order to add resources to this installer. -->
      <!-- <ComponentRef Id="ProductComponent" /> -->
      <ComponentRef Id="C128_100" />
      <ComponentRef Id="C128_200" />
      <ComponentRef Id="C128_300" />
      <ComponentRef Id="C128_400" />

      <!-- Note: The following ComponentGroupRef is required to pull in generated authoring from project references. -->
      <ComponentGroupRef Id="Product.Generated" />
    </Feature>
  </Product>
</Wix>

我不需要一个明确的答案,一个解释如何实现我想要的资源的链接将有很长的路要走。

4

1 回答 1

1

我找到了解决我的问题的方法。
答案是使用 Directory WINDOWSVOLUME

这是 WIX-xml 中的解决方案:

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="WINDOWSVOLUME">
        <Directory Id="DvWebImp" Name="dvimport">
          <Component Id="DataReadApp" Guid="YOURGUID-4423-9C81-29937C31DF8A">
            <File Id="Data_Read.exe" Source="Data_Read.exe" />
            <File Id="Data_Read.ini" Source="Data_Read.ini" />
          </Component>
        </Directory>
      </Directory>
    </Directory>
于 2012-06-29T08:45:13.723 回答