Register a COM dll in the GAC with WiX
Greetings all,
I'm wo开发者_如何学Gorking on a WiX installation script for my program. I need to install a C# dll to the GAC and then register it. So, I mark the file with Assembly=".net"
so that WiX GACs it for me, and then I have a deferred custom action, set to run before InstallFinalize
, which calls Assembly.Load
to load the assembly from the GAC and then RegistrationServices.RegisterAssembly
to register it.
Should be perfect, except for one problem: Apparently the dll isn't actually written to the GAC until the commit phase, so when my custom action runs, Assembly.Load
throws because it can't find the file. Where is it? Is it at all accessible before the commit phase? Or is there a better way to do this entirely? Seems like such a trivial thing...
Please do not suggest using heat.exe
; I'd really like to avoid it. My program has a ComRegisterFunction
that would like to execute on the user's computer if at all possible.
Self-registration in general is frowned upon during installation, exactly because of problems like the one you described. You should add the registry entries to the WiX script instead.
Also, you are not installing your assembly in the GAC only, are you? Point your COM registration to the non-GAC location.
精彩评论