Replies: 5 comments
-
Have a look at the dedicated sample: wixsharp/Source/src/WixSharp.Samples/Wix# Samples/ComServer/setup.cs Lines 19 to 21 in a3e85e8 Thus dealing with COM might be as simple as the code below: project.AfterInstall += e =>
{
if (!e.IsUninstalling)
Tasks.RegisterComAssembly(e.InstallDir.PathCombine("my_server.dll"), true);
};
project.BeforeInstall += e =>
{
if (e.IsUninstalling)
Tasks.RegisterComAssembly(e.InstallDir.PathCombine("my_server.dll"), false);
}; Mind you, it is not the MSI/WiX-endorsed way of registering COM. But to be honest it is quite practical. Though with some limitations. IE if you lost your assembly you cannot unregister your COM. That's why today, self-registering services are considered as an anti-pattern. But you assessed your risks and decided to give it a go, then you can definitely make this choice. |
Beta Was this translation helpful? Give feedback.
-
Have a look at It can be a good compromise of these two mutually exclusive techniques. |
Beta Was this translation helpful? Give feedback.
-
Thanks oleg, I really appreciate your work on WIX# and your dedication to it :) I am working on moving from Inno. I had seen that Sample earlier but did not notice it had two methods in it and did not look at the BuildWithHeat option. I am generally not worried about the self registration since the dll is only used by my application. I got using regsvr.exe working using process but will go back and take a look at using the BuildWithHeat option. Here is what I put together using a Process and regasm.exe
|
Beta Was this translation helpful? Give feedback.
-
I tried to use heat earlier from the command line (and I may be doing it wrong) but using: heat.exe file .dll -out t.t I get this: heat.exe : warning HEAT5150: Could not harvest data from a file that was expected to be a SelfReg DLL: C:\dev\winpharmsql.install\SourceDir\V_9.16<dll name>.dll. If this file does not support SelfReg you can ignore this warning. Otherwise, this error detail may be helpful to diagnose the failure: Unable to load file: C:\dev\winpharmsql.install\SourceDir\V_9.16<dll name>.dll, error: 193 and since I was getting this along with every other problem I was having and regasm.exe just worked I gave up and just tried to go with using regasm.exe and process. I am open to trying again but I am not sure what to do since heat wasn't working... |
Beta Was this translation helpful? Give feedback.
-
I know your pain. I came from the era where COM was considered as a saver :) COM is too messy to try to get it perfect. And the tools (e.g. heat.exe) are not that perfect either. |
Beta Was this translation helpful? Give feedback.
-
As part of my setup I have two .NET COM Dll's that need to be registered. You can register them from the command line using regasm like so:
%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\regasm.exe .dll /tlb:.tlb /codebase
It seems there would be some WIX or WIX# means for accomplishing this but I have looked and looked and can not find a means for doing it that is either straight forward or works. I think I am going to try just a process.start method next that just calls regasm.exe... Is there something that I am missing?
Beta Was this translation helpful? Give feedback.
All reactions