WiX Register Assemblies for COM Interop

I am really struggling with WiX. I have .NET assemblies for installation that require registration for COM Interop, and they must be registered in another structure that requires a call to the Register () method in the .NET assembly, which is located in the GAC. This registration method is a "black box" with a hidden storage mechanism, so I can not perform this operation declaratively.

I understand that a declarative approach is best for registering COM, but I have two problems using heat.exe:

  • RegAsm works, but Heat.exe clamps my assembly with a message:

    heat.exe: warning HEAT5151: it is possible not to collect data from a file that was expected to be an assembly: C: [...] for .. If this file is not an assembly, you can ignore this warning. Otherwise, this error detail may be useful for diagnosing a failure: an exception was thrown by the t-argument call.

  • The secondary registration I need to do depends on the [ComRegisterFunction] attribute, which usually triggers further actions during assembly registration for COM Interop. This usually happens when the assembly is registered with RegAsm.exe or System.Runtime.InteropServices.RegistrationServices is called. Therefore, I need the ComRegisterFunction in my assembly to be executed during installation.

I don’t mind the declarative approach to registering COM (or I don’t mind if it worked warmly on my assembly), but I need to call ComRegisterFunction part of the installation process. Ideally, I would like to look at all the executables that I install, reflect them for any methods with the [ComRegisterFunction] attribute, and call these methods, this will be done after all the files are installed.

How can I achieve this in WiX? Or is there a different approach? If that makes any difference, I use Visual Studio Vocal integration with the project recommendations.

0
source share
2 answers

. , Regasm.exe Regsvr32.exe . , [ComRegisterFunction] . .

, heat.exe , , , - . , DLL- . Project + Properties, Debug make heat.exe . DLL. Debug + Exceptions "" CLR, .

, RegistrationServices.RegisterAssembly . Regasm.exe , .

+1

, , , - .

, , SelfRegCost File Component.

, .

<File Source="..\..\External References\MSCAL.OCX" SelfRegCost="1"/>

SO, , .

0

Source: https://habr.com/ru/post/1768914/


All Articles