Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In WXS, how to I refer to a file that is installed via a different component?

Tags:

com

wix

regasm

heat

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.

like image 780
Cheeso Avatar asked Jul 28 '11 19:07

Cheeso


1 Answers

[#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.

like image 151
Bob Arnson Avatar answered Sep 28 '22 03:09

Bob Arnson