在Wix安装期间创建子文件夹并将文件添加到其中

时间:2013-11-13 08:02:48

标签: c# visual-studio-2010 wix windows-installer package

我正在为我的C#应用​​程序进行Wix安装,一切都要工作。但是,以下代码无法创建子文件夹,也无法将文件放入其中。如果你们能查看它并让我知道我做了什么错误,我将不胜感激。

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
  <Product Id="*" Name="MyApp" Language="1033" Version="1.0.0.0" Manufacturer="MyApp" UpgradeCode="a84565c2-d23a-456e-a69b-507890e7d08b">
      <Package Id="*" InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

      <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
      <MediaTemplate EmbedCab="yes" />

      <Feature Id="ProductFeature" Title="MyApp" Level="1">
          <ComponentGroupRef Id="ProductComponents" />
      </Feature>

  <!--User Interface-->
  <UIRef Id="WixUI_Mondo" />

  </Product>

  <Fragment>
      <Directory Id="TARGETDIR" Name="SourceDir">
          <Directory Id="ProgramFilesFolder">
      <Directory Id="INSTALLFOLDER" Name="MyApp" />
          </Directory>
  </Directory>

  <DirectoryRef Id="INSTALLFOLDER">
    <Directory Id="LangPL" Name="pl-PL" />
    <Directory Id="LangDE" Name="de-DE" />
    <Directory Id="LangNL" Name="nl-NL" />
    <Directory Id="LangIT" Name="it-IT" />
    <Directory Id="LangZH" Name="zh-Hans" />
    <Directory Id="LangES" Name="es-ES" />
    <Directory Id="LangRU" Name="ru-RU" />
    <Directory Id="LangFR" Name="fr-FR" />
    <Directory Id="LangUS" Name="en-US" />
  </DirectoryRef>
</Fragment>

<!-- Fragment to Add files to install folder-->
  <Fragment>
      <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
    <Component Guid="{0F129003-1A21-4F8F-93E6-E1B5D32EA2E7}">
      <File Source="$(var.App.TargetPath)" KeyPath="yes" />
    </Component>
    <Component Guid="{8E58912F-C519-4163-9DD8-1AB9D355A046}">
      <File Source="..\App\bin\Debug\APP.exe.config" KeyPath="yes" />
    </Component>

    <!-- Database Files -->
    <Component Guid="{37ABA3DA-86D9-4523-BDB7-0AD5C3708762}">
      <File Source="..\App\bin\Debug\DB.mdf" KeyPath="yes" />
    </Component>
    <Component Guid="{1194A878-D4B8-4B22-8F14-9D9EF93747D3}">
      <File Source="..\App\bin\Debug\DB_log.ldf" KeyPath="yes" />
    </Component>

    <!-- DLL Files -->
    <Component Guid="{87FCEE21-E1C4-4A2C-AA62-B6C668AB0E52}">
      <File Source="..\App\bin\Debug\AxInterop.AcroPDFLib.dll" KeyPath="yes" />
    </Component>
    <Component Guid="{BFF2CCF9-3503-47AB-AB77-E78F273B2FC6}">
      <File Source="..\App\bin\Debug\AxInterop.ShockwaveFlashObjects.dll" KeyPath="yes" />
    </Component>
    <Component Guid="{6C0D941F-A005-4E10-BAA6-391E70295EB2}">
      <File Source="..\App\bin\Debug\Interop.AcroPDFLib.dll" KeyPath="yes" />
    </Component>
    <Component Guid="{9B0BB779-74F3-456B-B616-BBF4BAE139E3}">
      <File Source="..\App\bin\Debug\Interop.ShockwaveFlashObjects.dll" KeyPath="yes" />
    </Component>
    <Component Guid="{09071A2C-1DB6-4AE5-9D9E-17DB57616D4B}">
      <File Source="..\App\bin\Debug\Microsoft.SqlServer.BatchParser.dll" KeyPath="yes" />
    </Component>
    <Component Guid="{75321BD4-C241-499F-90A6-B6363357F20C}">
      <File Source="..\App\bin\Debug\Microsoft.SqlServer.ConnectionInfo.dll" KeyPath="yes" />
    </Component>
    <Component Guid="{46A6DBEC-D969-40F4-AAF3-AF212FE5281E}">
      <File Source="..\App\bin\Debug\Microsoft.SqlServer.Replication.dll" KeyPath="yes" />
    </Component>
    <Component Guid="{815B4D31-A7B8-4CD7-8470-99DFADF7AEE3}">
      <File Source="..\App\bin\Debug\Microsoft.SqlServer.Smo.dll" KeyPath="yes" />
    </Component>
    <Component Guid="{33354D4A-5CB6-49CB-8C05-18D0F3191538}">
      <File Source="..\App\bin\Debug\Microsoft.SqlServer.SqlEnum.dll" KeyPath="yes" />
    </Component>
    <Component Guid="{9D8D4126-A718-48D9-BA34-EAD91F30CE88}">
      <File Source="..\App\bin\Debug\Utilities.dll" KeyPath="yes" />
    </Component>
      </ComponentGroup>
  </Fragment>

<!-- Fragment for Language -->
<Fragment>

  <!-- Language Files -->
  <DirectoryRef Id="LangDE">
    <Component Id="cmp86C295D7F66EC9578F96F4623F089C67" Guid="{1C8790A6-41C2-4E16-8E31-10EDECE86247}">
      <File Id="fil3C1CE3C61A61928116642D76E1CB2FD1" KeyPath="yes" Source="..\App\bin\Debug\de-DE\App.resources.dll" />
    </Component>
  </DirectoryRef>
  <DirectoryRef Id="LangPL">
    <Component Id="cmp8F8D4A93706A9F8808F5E2985188A413" Guid="{17C8306C-5974-405B-952F-DC45B0818E39}">
      <File Id="fil55B857264E5ABC88F6EA12CEA4B93C2A" KeyPath="yes" Source="..\App\bin\Debug\pl-PL\App.resources.dll" />
    </Component>
  </DirectoryRef>
  <DirectoryRef Id="LangIT">
    <Component Id="cmpA89C227C566FDB4BCDF630318E40C7E5" Guid="{C09B8F97-ADD5-4FB8-8670-8BA1E34F6709}">
      <File Id="filA0C4161E00B664DB9961F7F1D1FC40AD" KeyPath="yes" Source="..\App\bin\Debug\it-IT\App.resources.dll" />
    </Component>
  </DirectoryRef>
  <DirectoryRef Id="LangFR">
    <Component Id="cmpC6BCCBC4286751A9F3AA247597AD0861" Guid="{F74428CD-F7ED-4C36-8AE4-1BC72F43FCBA}">
      <File Id="fil1784EB69DBD3581198FFE97FB812B1E0" KeyPath="yes" Source="..\App\bin\Debug\fr-FR\App.resources.dll" />
    </Component>
  </DirectoryRef>
  <DirectoryRef Id="LangUS">
    <Component Id="cmpCC8D717E06A1A3AC08A128C5A16928A2" Guid="{EC66B5A5-42F4-45AB-A782-9C4420855A25}">
      <File Id="filBF78840BD50DBF938D4331D2BE1EC95C" KeyPath="yes" Source="..\App\bin\Debug\en-US\App.resources.dll" />
    </Component>
  </DirectoryRef>
  <DirectoryRef Id="LangES">
    <Component Id="cmpDDA77EFB7EFD0EAC732A90C4F40031CF" Guid="{2AFDCEEE-5F75-47CC-BE81-4473C523C583}">
      <File Id="fil702C9D4400C38C1E053F89C06FB02125" KeyPath="yes" Source="..\App\bin\Debug\es-ES\App.resources.dll" />
    </Component>
  </DirectoryRef>
  <DirectoryRef Id="LangNL">
    <Component Id="cmpE263B74764498E93EE67602DF6EC34A3" Guid="{EBE1DC48-709A-4B27-ABFD-C2EAF1F8F045}">
      <File Id="fil25E319C7D7844EE691033BE7B5076021" KeyPath="yes" Source="..\App\bin\Debug\nl-NL\App.resources.dll" />
    </Component>
  </DirectoryRef>
  <DirectoryRef Id="LangRU">
    <Component Id="cmpEA3A3E0AC21B81AC658C77C2DD655AB6" Guid="{E10BA360-E9ED-48D2-9A32-17E436764BA1}">
      <File Id="fil6C4DA2534BE3D68B4E4FB677FAC1660C" KeyPath="yes" Source="..\App\bin\Debug\ru-RU\App.resources.dll" />
    </Component>
  </DirectoryRef>
  <DirectoryRef Id="LangZH">
    <Component Id="cmpF2AD194BB8C30284155E9D01AE39BF26" Guid="{7C236F8F-B790-4C8F-8573-3A86D083BC7B}">
      <File Id="fil0A5479D9006A1049B58101823121F91A" KeyPath="yes" Source="..\App\bin\Debug\zh-Hans\App.resources.dll" />
    </Component>
  </DirectoryRef>
</Fragment>
</Wix>

1 个答案:

答案 0 :(得分:0)

问题是您没有将包含目录的组件添加到任何功能。

您需要创建一个ComponentGroup,其中包含您的Directories的每个组件ID,然后创建一个ComponentGroupRef到您的功能中的组件ID。

但是我建议创建一个新的子功能&#34;语言包&#34;以及每种语言的另一个子功能,然后您的用户可以选择安装或不安装特定的语言包。

这样的事情:

<Feature Id="ProductFeature" Title="MyApp" Level="1">
      <ComponentGroupRef Id="ProductComponents" />
      <Feature Id="LanguagePacks" Title="Language Packs" Level="1">
          <Feature Id="FrenchPack" Title="French" Level="1">
              <ComponentRef Id="FrenchComponentId" />
          </Feature>
          <Feature Id="ItalianPack" Title="Italian" Level="1">
              <ComponentRef Id="ItalianComponentId" />
          </Feature>

      </Feature>
  </Feature>