2013-08-20 40 views
5

Tôi muốn cài đặt ứng dụng của tôi vào cấu trúc thư mục sau:WIX ComponentGroup thư mục con

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

Đối với điều này, tôi đã xác định thư mục sau:

<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> 

Bây giờ tôi đã xác định 1 tính năng với một tham chiếu đến một nhóm thành phần. Nhóm thành phần này có thuộc tính "Directory" trỏ đến "INSTALLFOLDER". Nhưng khi bây giờ tôi tuyên bố một thành phần trong nhóm thành phần mà cũng có một "Directory" -property (trỏ đến DATABASE_PLUGINS), VS sẽ không cho phép tôi xây dựng thiết lập.

<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> 

Làm cách nào để thiết lập tạo thư mục con bên trong thư mục cài đặt chính của tôi và đặt các tệp được khai báo vào thư mục đó?

+6

Tôi sẽ đi ra ngoài cánh một ở đây và nói rằng bạn phải khai báo các thành phần bên ngoài ComponentGroup và sử dụng một yếu tố ComponentRef để thêm nó vào nhóm – Netfangled

+0

Làm việc như một sự quyến rũ. Cảm ơn nhiều. =) – Atrotygma

Trả lời

4

đây là ví dụ đầy đủ của tôi, tôi hy vọng điều này giúp các nhà phát triển hơn nữa

</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> 
Các vấn đề liên quan