WiX没有嵌入二进制文件

时间:2013-01-05 19:47:46

标签: visual-studio wix install

我正在使用WiX创建我的产品安装程序。由于某种原因,它不再在安装程序中嵌入.exes和.dll。所以我有这个:

<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="ProgramFilesFolder">
    <Directory Id="USERSPECIFIEDDIR" Name="My-app-name" />
  </Directory>

它会在名为My-app-name的文件夹旁边创建一个.msi,其中包含应用程序所需的所有.exe和dll文件。如果我从那里运行安装程序,它没关系,但如果我将msi移动到其他地方(没有子目录),它会因为无法找到文件而出错。我怎么能告诉WiX在安装程序中嵌入所有二进制文件?

如果有帮助,这里有一些来自我的wxs的其他片段。如果您需要任何其他信息,请与我们联系。哦,我直接从visual studio 2008使用wix。

<DirectoryRef Id="USERSPECIFIEDDIR">
  <Component Id="MainExe" Guid="580F8F15-C06C-49A7-ADDC-56C96580DC0D">
    <File Id="MainExe" Name="OrderMonkey.exe" KeyPath="yes" />
  </Component>
  <Component Id="OMEmailerExe" Guid="3B0AECC3-67E5-40B3-83CB-9B84FE965ED8">
    <File Id="OMEmailerExe" Name="OMEmailer.exe" />
  </Component>
  <Component Id="migradomDLL" Guid="37E1BCAE-EB39-4DF5-88C7-AE74CA5EA171">
      <File Id="migradom" Name="MigraDoc.DocumentObjectModel.dll" />
  </Component>
  <Component Id="migrarenderDLL" Guid="C2910B9E-0B06-467A-853C-7651BE7BD9E4">
        <File Id="migrarender" Name="MigraDoc.Rendering.dll" />
  </Component>
  <Component Id="migrartfDLL" Guid="CEBE4DE9-7CA0-4F48-A8B1-1D46E4E48B66">
          <File Id="migrartf" Name="MigraDoc.RtfRendering.dll" />
  </Component>
  <Component Id="mysqldataDLL" Guid="2E474737-474C-4146-8E67-D3837B5DB862">
            <File Id="mysqldata" Name="MySql.Data.dll" />
  </Component>
  <Component Id="pdfchartingDLL" Guid="7467B6C2-BE38-4283-B179-9FA94C4A087F">
              <File Id="pdfcharting" Name="PdfSharp.Charting.dll" />
  </Component>
  <Component Id="pdfsharpDLL" Guid="39F23E36-BF9C-40C1-8190-6A3554B879BC">
                <File Id="pdfsharp" Name="PdfSharp.dll" />
  </Component>
  <Component Id="sqliteDLL" Guid="B043CF20-8DC2-4A10-AE4B-4721263A111E">
    <File Id="sqlite" Name="System.Data.SQLite.dll" KeyPath="yes" />
  </Component>
</DirectoryRef>
<DirectoryRef Id="ApplicationProgramsFolder">
  <Component Id="ApplicationShortcut" Guid="414E91FD-7410-492C-9D48-8125C6ECCF0B">
    <Shortcut Id="ApplicationStartMenuShortcut"
              Name="Order Monkey"
              Description="Order Monkey Orders and Quotes"
              Target="[USERSPECIFIEDDIR]OrderMonkey.exe"
              WorkingDirectory="USERSPECIFIEDDIR" />
    <Shortcut Id="ApplicationOfflineStartMenuShortcut"
              Name="Order Monkey Offline"
              Description="Order Monkey Orders and Quotes"
              Target="[USERSPECIFIEDDIR]OrderMonkey.exe"
              WorkingDirectory="USERSPECIFIEDDIR" 
              Arguments="-offline" />
    <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
    <RegistryValue Root="HKCU" Key="Software\Microsoft\OrderMonkey" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
  </Component>
</DirectoryRef>

<Feature Id='Complete' Level='1' Title='Order Monkey Complete' Description='The complete package' ConfigurableDirectory='TARGETDIR' Display='expand'>
  <ComponentRef Id='MainExe' />
  <ComponentRef Id='OMEmailerExe' />
  <ComponentRef Id='migradomDLL' />
  <ComponentRef Id='migrarenderDLL' />
  <ComponentRef Id='migrartfDLL' />
  <ComponentRef Id='mysqldataDLL' />
  <ComponentRef Id='pdfchartingDLL' />
  <ComponentRef Id='pdfsharpDLL' />
  <ComponentRef Id='sqliteDLL' />
  <ComponentRef Id='ApplicationShortcut' />
  <ComponentRef Id='AppData' />
</Feature>

1 个答案:

答案 0 :(得分:6)

使用以下元素:

<Package Compressed="yes" InstallScope="perMachine" />
<MediaTemplate EmbedCab="yes" />

Package/@Compressed="yes"创建文件柜而不是松散文件。 MediaTemplate/@EmbedCab="yes"将默认文件柜嵌入.msi。