Why does regasm /regfile seem incomplete?

寵の児 提交于 2019-12-10 17:15:45

问题


I have a .NET assembly I need to register at install time. I'm noticing that the registry has subtle differences when regasm is used directly versus being installed via regasm's registry script.

Here's my test:

I export the original HKCR hive, then run: regasm my.dll

From there, I export the subsequent HKCR hive and performance a diff.

I then compare that diff with the output of regasm my.dll /regfile

There are a couple very important entries that get added via regasm my.dll that will never get added with the registry file output from the regasm command. Why?

From an install point-of-view, I'd very much hate to call regasm during the install process. I'd rather just run this .reg script. I'm using InstallShield now, which under the hood is also missing the extra registry entries (it seems like it embeds the registry changes outputted with the /regfile flag).


回答1:


Per Regasm.exe (Assembly Registration Tool) (Remarks Section)

You can use the /regfile option to generate a .reg file that contains the registry entries instead of making the changes directly to the registry. You can update the registry on a computer by importing the .reg file with the Registry Editor tool (Regedit.exe). Note that the .reg file does not contain any registry updates that can be made by user-defined register functions. Note that the /regfile option only emits registry entries for managed classes. This option does not emit entries for TypeLibIDs or InterfaceIDs.

InstallShield has a setting called ".NET COM Interop" that basically tells the build engine to perform a regasm /regfile and transform the results into the registry table before building the MSI. You can keep doing this if you want but you'll have to add the extra stuff statically.




回答2:


Additional registry manipulation is going on behind-the-scenes in methods decorated with the ComRegisterFunction attribute. Apparently these methods aren't invoked with the /regfile switch.



来源:https://stackoverflow.com/questions/14652483/why-does-regasm-regfile-seem-incomplete

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!