原因
当您<Directory Id="WIX_DIR_COMMON_DOCUMENTS">
在合并模块源中写入时,WiX 会将目录 ID模块化,以防止与使用合并模块的产品中的任何现有目录 ID 发生冲突。
您可以通过在 Orca 或InstEd(推荐)中打开 MSM 文件并查看Directory
表格来验证这一点。您将看到一个目录 ID,如WIX_DIR_COMMON_DOCUMENTS.9FE2C761_1860_4D8C_8538_352164BDC12F
. 附加的 GUID 是合并模块 ID。
不幸的是,自定义操作WixQueryOsDirs
仅设置属性WIX_DIR_COMMON_DOCUMENTS
而不是使用模块化目录 ID,因此模块化目录 ID 仍将指向程序文件目录。
解决方案
像这样抑制模块化WIX_DIR_COMMON_DOCUMENTS
:
<PropertyRef Id="WIX_DIR_COMMON_DOCUMENTS"/>
<Property Id="WIX_DIR_COMMON_DOCUMENTS" SuppressModularization="yes"/>
在构建使用合并模块的设置时,当此设置已经引用WIX_DIR_COMMON_DOCUMENTS
或来自 WixUtilExtension 的其他目录时,您可能会收到一些警告。这些可以安全地忽略。
例如。在我的实验中,我收到了以下警告:
C:\Users\REDACTED\source\repos\SetupProject1\SetupProject1\Product.wxs(38,0): warning LGHT1056: The Directory table contains a row with primary key(s) 'WIX_DIR_COMMON_DOCUMENTS' which cannot be merged from the merge module 'C:\Users\REDACTED\source\repos\SetupProject1\MergeModule1\bin\Debug\MergeModule1.msm'. This is likely due to collision of rows with the same primary key(s) (but other different values in other columns) between the database and the merge module.
C:\Users\REDACTED\source\repos\SetupProject1\SetupProject1\Product.wxs(38,0): warning LGHT1055: The InstallUISequence table contains an action 'WixQueryOsDirs' which cannot be merged from the merge module 'C:\Users\REDACTED\source\repos\SetupProject1\MergeModule1\bin\Debug\MergeModule1.msm'. This action is likely colliding with an action in the database that is being created. The colliding action may have been authored in the database or merged in from another merge module. If this is a standard action, it is likely colliding due to a difference in the condition for the action in the database and merge module. If this is a custom action, it should only be declared in the database or one merge module.
C:\Users\REDACTED\source\repos\SetupProject1\SetupProject1\Product.wxs(38,0): warning LGHT1055: The InstallExecuteSequence table contains an action 'WixQueryOsDirs' which cannot be merged from the merge module 'C:\Users\REDACTED\source\repos\SetupProject1\MergeModule1\bin\Debug\MergeModule1.msm'. This action is likely colliding with an action in the database that is being created. The colliding action may have been authored in the database or merged in from another merge module. If this is a standard action, it is likely colliding due to a difference in the condition for the action in the database and merge module. If this is a custom action, it should only be declared in the database or one merge module.
C:\Users\REDACTED\source\repos\SetupProject1\SetupProject1\Product.wxs(38,0): warning LGHT1056: The CustomAction table contains a row with primary key(s) 'WixQueryOsDirs' which cannot be merged from the merge module 'C:\Users\REDACTED\source\repos\SetupProject1\MergeModule1\bin\Debug\MergeModule1.msm'. This is likely due to collision of rows with the same primary key(s) (but other different values in other columns) between the database and the merge module.
C:\Users\REDACTED\source\repos\SetupProject1\SetupProject1\Product.wxs(38,0): warning LGHT1056: The Property table contains a row with primary key(s) 'SecureCustomProperties' which cannot be merged from the merge module 'C:\Users\REDACTED\source\repos\SetupProject1\MergeModule1\bin\Debug\MergeModule1.msm'. This is likely due to collision of rows with the same primary key(s) (but other different values in other columns) between the database and the merge module.
所以 WiX 告诉我们它不能导入属性WIX_DIR_COMMON_DOCUMENTS
和SecureCustomProperties
自定义操作WixQueryOsDirs
,因为它们已经存在于主产品中。这没什么好担心的,因为合并模块的组件会愉快地使用现有的属性WIX_DIR_COMMON_DOCUMENTS
。