在 WXS 中,如何引用通过不同组件安装的文件?
这个问题涉及 heat.exe 的输出。我正在尝试在 MSI 中为 COM 互操作注册一些 .NET 程序集做“正确的事情”。 Regasm.exe 是错误。
直接调用 regasm.exe,这很简单并且“大部分”工作,显然不是一个好主意,Rob Mensching 说道。 该博文解释了为什么这不是一个好主意,并且还提供了一个非常简单的解决方案。不幸的是,2004 年的帖子提出了一个 wix 功能,但现在已被弃用或不受支持。 我猜那里描述的解决方案不再有效,但该博客文章中提出的问题仍然存在。
显然,问题的“正确”解决方案是运行 heat.exe,然后“修复”目录引用等。这听起来很简单,这就是我正在努力做的事情。
好的,所以我正在努力做正确的事。另外,我不想对程序集进行 GAC,这意味着我必须使用 codebase
参数进行 COM 注册。 heat.exe 的输出包括如下内容:
<RegistryKey Root="HKCR" Key="CLSID\{xxx-GUID-HERE-xxx-xxx}\InprocServer32\1.2.3.4" >
<RegistryValue Name="Class" Value="My.DotNet.Classname.Here" Type="string" />
<RegistryValue Name="Assembly" Value="Strongname of .NET Assembly here" />
<RegistryValue Name="RuntimeVersion" Value="v2.0.50727" Type="string" />
<RegistryValue Name="CodeBase" Value="file:///[#fil4B562083D141F5A2F29E28A1BD09AF3E]" Type="string" />
</RegistryKey>
第一个问题: Value="file:///[#fil4B562083D141F5A2F29E28A1BD09AF3E]" 到底是什么?
在我看来, fil4B562083D141F5A2F29E28A1BD09AF3E
是由Wix生成的Id;该 id 属于 .wxs 文件中的 File 元素,它指的是包含指定 .NET 类的程序集 (DLL) 的路径。现在,奥克索普到底是做什么用的?方括号呢?和 file:///
前缀?帮助我理解这个语法。
我问的原因是 - 我不想使用这个 ID。我已经有一个文件 ID,它反映了文件的实际含义,但事实并非如此。
但有问题的文件安装在不同的组件中。当我尝试引用该文件时,我收到一堆此类错误消息:
C:\dev\project\ComRegistration.wxs(397): warning LGHT1076: ICE69: Mismatched component reference.
Entry 'reg9652ABFDD2B970C523070996FE7BB510' of the Registry table belongs to
component 'C.ComRegistration'. However, the formatted string in column 'Value' references
file 'MyAssembly.dll' which belongs to component 'C.Main'. Components are in the same
feature. [C:\dev\project\MyProject.wixproj]
如何解决此问题?
我想我不希望此组件中存在另一个引用同一个文件系统文件的 File
元素。它已经安装了不同的组件(相同的功能)。我怎样才能参考它?
基本上我想要一个像 FileRef
这样的元素,但显然不存在。
This question refers to output from heat.exe. I'm trying to do "the right thing" with respect to registering some .NET assemblies for COM interop in the MSI. Regasm.exe is the wrong thing.
Calling regasm.exe directly, which is easy and works "mostly", is apparently not a good idea, says Rob Mensching.
That blog post explains WHY it's not a good idea, and also offers a very simple solution. Unfortunately the post from 2004 suggests a wix feature that is now deprecated or not supported.
The solution described there is no longer valid, I guess, but the problem laid out in that blog post remains .Apparently the "correct" solution to the problem is to run heat.exe and then "fixup" the directory references and so on. That sounds simple enough, and is what I am trying to do.
ok, so I'm trying to do the right thing. Also I don't want to GAC the assembly, which means I must do the COM registration with the codebase
argument. The output of heat.exe includes something like this:
<RegistryKey Root="HKCR" Key="CLSID\{xxx-GUID-HERE-xxx-xxx}\InprocServer32\1.2.3.4" >
<RegistryValue Name="Class" Value="My.DotNet.Classname.Here" Type="string" />
<RegistryValue Name="Assembly" Value="Strongname of .NET Assembly here" />
<RegistryValue Name="RuntimeVersion" Value="v2.0.50727" Type="string" />
<RegistryValue Name="CodeBase" Value="file:///[#fil4B562083D141F5A2F29E28A1BD09AF3E]" Type="string" />
</RegistryKey>
First question: What exactly is Value="file:///[#fil4B562083D141F5A2F29E28A1BD09AF3E]"
?
It seems to me that fil4B562083D141F5A2F29E28A1BD09AF3E
is an Id that is generated by Wix; The id belongs to a File element in the .wxs file, which refers to the path to the assembly (DLL) that contains the named .NET class. Now, what exactly is the octothorpe there for? And the square brackets? and the file:///
prefix? Help me understand this syntax.
The reason I ask - I don't want to use this Id. I already have an File Id, which reflects the actual meaning of the file, and it is NOT THAT.
But the file in question is installed in a different component. When I try referencing that File, I get a bunch of this kind of error message:
C:\dev\project\ComRegistration.wxs(397): warning LGHT1076: ICE69: Mismatched component reference.
Entry 'reg9652ABFDD2B970C523070996FE7BB510' of the Registry table belongs to
component 'C.ComRegistration'. However, the formatted string in column 'Value' references
file 'MyAssembly.dll' which belongs to component 'C.Main'. Components are in the same
feature. [C:\dev\project\MyProject.wixproj]
How do I resolve this?
I think I don't want another File
element in this component, referring to the same filesystem file. It's already installed with a different component (same feature). How can I refer to it?
Basically I want an element like FileRef
, but that apparently doesn't exist.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
[#fileId] 替换为文件的路径。 (请参阅 MSI SDK 中的“格式化” 获取完整列表。)
您可以通过将注册表值和文件放在同一组件中来避免 ICE69。 ICE69 告诉您,该文件有可能在未注册的情况下被安装。 (假设的 FileRef 无法解决该问题。)将它们放在一起,问题就不会发生,ICE69 也不会抱怨。
[#fileId] is replaced by the path to the file. (See "Formatted" in the MSI SDK for a full list.)
You can avoid ICE69 by putting the registry values and the file in the same component. ICE69 is telling you that there's the potential for the file to be installed without its registration. (A hypothetical FileRef wouldn't solve that problem.) Put them together, the problem can't occur and ICE69 won't complain.