7

我想将我的应用程序安装到以下目录结构中:

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>

现在我已经定义了一个引用组件组的功能。该组件组具有指向“INSTALLFOLDER”的属性“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>

如何实现安装程序在我的主安装目录中创建一个子目录并将声明的文件放入其中?

4

1 回答 1

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>
于 2015-01-26T19:52:50.227 回答