wix 为不同的目录重用 ComponentGroup
wix reusing ComponentGroup for different directories
我目前正在使用 WIX 编写安装程序。
我把每个项目都放在自己的 ComponentGroup
中,像这样:
<ComponentGroup Id="CG.MyLib" >
<Component Id="C.MyLib" Guid="{349e5aa6-d935-48fe-9170-a36928c13545}" Directory="INSTALLFOLDER">
<File Id="MyLib" Source="$(var.MyLib.TargetPath)" KeyPath="yes" Checksum="yes" />
</Component>
<!-- #region Referenced Projects -->
<ComponentGroupRef Id="CG.A_COMPONENT_I_NEED_IN_MyLib" />
<ComponentGroupRef Id="CG.AnotherDependendComponent" />
<!-- #endregion Referenced Projects -->
<!-- #region References -->
<Component Id="MyLib_References" Guid="{0c77a027-2b1e-44fc-9c1d-fcda80acb740}" Directory="INSTALLFOLDER">
<File Id="SomExtraDll_I_Need.dll" Source="$(var.MyLib.TargetDir)\SomExtraDll_I_Need.dll" />
</Component>
<!-- #endregion References -->
</ComponentGroup>
但现在我必须将同一个组件组安装到多个目录中。
我该怎么做?
您需要使用 ComponentGroup ELement 中的 Directory 元素。
Directory- 设置子组件元素的默认目录标识符。
我在使用 ComponentGroup 的示例项目中进行了尝试,但无法在多个位置部署相同的组件。所以我通读了 windows 安装程序文档,这是我遇到的:
用户计算机上只安装了任何组件的单个实例。
切勿创建两个组件以相同的名称和目标位置安装资源。如果资源必须在多个组件中复制,请在每个组件中更改其名称或目标位置。此规则应适用于应用程序、产品、产品版本和公司。
总而言之,这是一个 windows 安装程序限制。如果你想在多个位置安装相同的文件,你必须将它们定义为具有不同 ID 的单独组件。使用 MSI 只能将单个组件安装到一个位置。另一种选择是使用 CopyFile Element
我目前正在使用 WIX 编写安装程序。
我把每个项目都放在自己的 ComponentGroup
中,像这样:
<ComponentGroup Id="CG.MyLib" >
<Component Id="C.MyLib" Guid="{349e5aa6-d935-48fe-9170-a36928c13545}" Directory="INSTALLFOLDER">
<File Id="MyLib" Source="$(var.MyLib.TargetPath)" KeyPath="yes" Checksum="yes" />
</Component>
<!-- #region Referenced Projects -->
<ComponentGroupRef Id="CG.A_COMPONENT_I_NEED_IN_MyLib" />
<ComponentGroupRef Id="CG.AnotherDependendComponent" />
<!-- #endregion Referenced Projects -->
<!-- #region References -->
<Component Id="MyLib_References" Guid="{0c77a027-2b1e-44fc-9c1d-fcda80acb740}" Directory="INSTALLFOLDER">
<File Id="SomExtraDll_I_Need.dll" Source="$(var.MyLib.TargetDir)\SomExtraDll_I_Need.dll" />
</Component>
<!-- #endregion References -->
</ComponentGroup>
但现在我必须将同一个组件组安装到多个目录中。
我该怎么做?
您需要使用 ComponentGroup ELement 中的 Directory 元素。
Directory- 设置子组件元素的默认目录标识符。
我在使用 ComponentGroup 的示例项目中进行了尝试,但无法在多个位置部署相同的组件。所以我通读了 windows 安装程序文档,这是我遇到的:
用户计算机上只安装了任何组件的单个实例。
切勿创建两个组件以相同的名称和目标位置安装资源。如果资源必须在多个组件中复制,请在每个组件中更改其名称或目标位置。此规则应适用于应用程序、产品、产品版本和公司。
总而言之,这是一个 windows 安装程序限制。如果你想在多个位置安装相同的文件,你必须将它们定义为具有不同 ID 的单独组件。使用 MSI 只能将单个组件安装到一个位置。另一种选择是使用 CopyFile Element