2013-08-20 119 views
5

我想我的應用程序安裝到以下目錄結構:WIX ComponentGroup子目錄

MyCompany/ 
    MyApp/ 
     assembly1.dll 
     assembly2.dll 
     assembly3.dll 
     ... 
     plugins/ 
      plugin1.dll 
      plugin2.dll 

對於這一點,我定義了以下文件夾:

<Directory Id="TARGETDIR" Name="SourceDir"> 
    <Directory Id="ProgramFilesFolder"> 
     <Directory Id="CompanyFolder" Name="MyCompanyName"> 
      <Directory Id="INSTALLFOLDER" Name="MyProduct"> 
       <Directory Id="PLUGINS" Name="plugins"> 
        <Directory Id="DATABASE_PLUGINS" Name="db" /> 
       </Directory> 
      </Directory> 
     </Directory> 
    </Directory> 
</Directory> 

現在我已經定義1個功能用引用組件組。此組件組具有指向「INSTALLFOLDER」的屬性「Directory」。但是,當我現在在組件組中聲明瞭一個組件並具有「Directory」屬性(指向DATABASE_PLUGINS)時,VS不會讓我構建該設置。

<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> 
    <Component Id="DB.Connector.Extension.Plugins.SqlCe" Directory="DATABASE_PLUGINS" Guid="{ae87be28-b0c9-4b3e-915f-2b4bf9965c99}"> 
     <File Source="$(var.DB.Connector.Extension.Plugins.SqlCe.TargetDir)DB.Connector.Extension.Plugins.SqlCe.dll" KeyPath="yes" /> 
    </Component> 
</ComponentGroup> 

我怎樣才能做到這一點的設置創建在我的主安裝目錄並提出申報文件到它的子目錄?

+6

我要出去就在這裏肢體,說你必須聲明ComponentGroup外的成分和使用ComponentRef元素將其添加到羣組 – Netfangled

+0

像魅力一樣工作。非常感謝你。 =) – Atrotygma

回答

4

這裏是我完整的例子我希望這有助於進一步開發

</Product> 
    <Fragment> 
    <Directory Id="TARGETDIR" Name="SourceDir"> 
     <Directory Id="ProgramFiles64Folder"> 
     <Directory Id="GiladDir" Name="Gilad"> 
      <Directory Id="INSTALLFOLDER" Name="App"> 
      <Directory Id="BIN" Name="bin"></Directory> 
      </Directory> 
     </Directory> 
     </Directory> 
     <Directory Id="ProgramMenuFolder" Name="Programs"> 
     <Directory Id="ProgramMenuDir" Name="App"> 
      <Component Id="ProgramMenuDir" Guid="*"> 
      <RemoveFolder Id="ProgramMenuDir" On="uninstall" /> 
      <RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Type="string" Value="" KeyPath="yes" /> 
      </Component> 
     </Directory> 
     </Directory> 
    </Fragment> 
    <Fragment> 
    <ComponentGroup Id="group_tools"> 
     <ComponentRef Id="comp_tool_dll" /> 

    </ComponentGroup> 
    <DirectoryRef Id="INSTALLFOLDER"> 
     <Directory Id="bin" Name="bin"> 
     <Directory Id="Release" Name="Release"> 
      <Directory Id="Plugins" Name="Plugins"> 
      <Component Id="comp_tool_dll" DiskId="1" KeyPath="yes" Guid="*"> 
       <File Id="file_comp_tool_dll" Source="$(var.ReleaseSourcePath)\Plugins\tool.dll" /> 
      </Component>