Auto register .Net 4 assembly using AI 7.6.1 - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

jwest
Posts: 56
Joined: Tue Dec 27, 2005 12:14 am

Auto register .Net 4 assembly using AI 7.6.1

I'm using AI 7.6.1.

I had to build a version of my Excel COM Addin that targets .NET 4. I already target .NET 3 and have a working Advanced Installer project for the .NET 3 version.

I saved that to a new project, removed the old DLL (after removing all of the HKEY registry stuff) and replaced it with the new DLL that targets .NET 4.

When I tried to set the "Auto register .Net assembly for COM interop" option, I received "The selected file could not be registered" message.

I can register the dll that targets .NET 4 successfully with the following command line:

! C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm.exe MyAssembly.dll /codebase

The old dll that targets .NET 3 can be registered with:

! C:\Windows\Microsoft.NET\Framework64\v2.0.50727\regasm.exe MyAssembly.dll /codebase

Do I need an updated version of AI to handle .NET 4 assembly registration?

I need to be able to produce separate installers for both the .NET 3 and .NET 4 targetted DLLs.

Thanks
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Auto register .Net 4 assembly using AI 7.6.1

Hello,

Please keep in mind that the built-in auto-registration uses the "regasm.exe" file you specified in the "Options" -> "External Tools..." menu in Advanced Installer. You should make sure this is set to the intended path location.

Another solution is to create a custom action which registers the file. Here are the steps:
- go to the Search page
- create a search for the "regasm.exe" file
- go to the Custom Actions page
- create a new "Launch file or open URL" custom action
- set the "Command Line" field to the property of the search (which contains the regasm.exe path) and the path of the assembly you want to register (you can use a file reference through the "Edit" button)

Note that the custom action should be created under "InstallExecuteSequence" -> "Install". Also, it should be set as "Deferred" and it should use the condition (Not Installed).

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jwest
Posts: 56
Joined: Tue Dec 27, 2005 12:14 am

Re: Auto register .Net 4 assembly using AI 7.6.1

Thanks.

I build everything in batch. I need to build a .NET 4 and 3 version. I noticed that the path to regasm.exe is stored in HKEY_CURRENT_USER\Software\Caphyon\Advanced Installer\Settings\RegAsm Path. Can I simply change this via a script before invoking ai to build the .NET 4 version and then change it back to the .NET 3 (2) regasm afterwards?
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Auto register .Net 4 assembly using AI 7.6.1

Hello,
Can I simply change this via a script before invoking ai to build the .NET 4 version and then change it back to the .NET 3 (2) regasm afterwards?
Yes, if you are performing all operations from the command line, then you can set the "regasm.exe" path to point to the .NET 4 version before executing Advanced Installer and change it back to the .NET 3 version path location afterwards. The registry location you mentioned is indeed where this setting is stored.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”