简体   繁体   中英

How to register a dll into GAC with Installshield

I have installshield 2016 premier and I have a.Net dll that uses a com dll. My application is a plugin so the main exe (its not my exe), is looking mydll in windows even myplugin is in program files. Manually when I use "gacutil.exe -i mydll.dll" it works. Then the dll is not need to be in windows folder.

So I tried also regasm but it did not work. So i have to register mydll into gac somehow. The target machine has not gacutil.exe so i cannot call basically from command.

I looked at how installshield can do that but it did not work as well. I checked "self register" and "com extract at build" yes but did not work and i got an error while installing (because its not a pure com dll, it has only referenced a com dll with embed interop type). When I choose.Net Com Interop settings Yes, then installshield it not build my setup file.

So Is there anyway to register this dll during/end of installation?

Update : When i do "build and scan dependencies", it cannot find anything!

Use "Support files" functionality of InstallShiled and place gacUtil or installUtil into "Support files" folder and run the utility at the end of the installation. This may help to solve the problem. This is same like running from command prompt. Refer the link for more details

InstallShield 2019

It support GAC registration. This is automatic.

Com Interop and InstallShield

Related to Com interop, you have to expose the method: When you register a COM Interop you users

"C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe" /codebase "%System32%\YourComInterop.dll" /regfile:"YourComInterop.reg"

You get a reg file. This reg file have to be created with InstallShield in order to intall properly the comm interop.

    REGEDIT4

    [HKEY_CLASSES_ROOT\Your.Com.Interop.Namespase]
    @="Your.Com.Interop.YourFunction"

    [HKEY_CLASSES_ROOT\Your.Com.Interop.Namespase\CLSID]
    @="{42532EFE-D9FF-4135-A9A7-677E54024A81}"

    [HKEY_CLASSES_ROOT\CLSID\{42532EFE-D9FF-4135-A9A7-677E54024A81}]
    @="Your.Com.Interop.YourFunction"

    [HKEY_CLASSES_ROOT\CLSID\{42532EFE-D9FF-4135-A9A7-677E54024A81}\InprocServer32]
    @="mscoree.dll"
    "ThreadingModel"="Both"
    "Class"="Your.Com.Interop.YourFunction"
    "Assembly"="YourComInterop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b1eedcf58a40cdb8"
    "RuntimeVersion"="v4.0.30319"
    "CodeBase"="file:///C:/Windows/System32/YourComInterop.dll"

    [HKEY_CLASSES_ROOT\CLSID\{42532EFE-D9FF-4135-A9A7-677E54024A81}\InprocServer32\1.0.0.0]
    "Class"="Your.Com.Interop.YourFunction"
    "Assembly"="YourComInterop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b1eedcf58a40cdb8"
    "RuntimeVersion"="v4.0.30319"
    "CodeBase"="file:///C:/Windows/System32/YourComInterop.dll"

    [HKEY_CLASSES_ROOT\CLSID\{42532EFE-D9FF-4135-A9A7-677E54024A81}\ProgId]
    @="Your.Com.Interop.Namespase"

    [HKEY_CLASSES_ROOT\CLSID\{42532EFE-D9FF-4135-A9A7-677E54024A81}\Implemented Categories\{62C8FE65-4EBB-45E7-B440-6E`enter code here`39B2CDBF29}]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM