DevMountain
Posts: 9
Joined: Mon Feb 04, 2008 11:44 am

Regasm for COMInterop assembly on 64-bit PC

I have an installer that works fine with registering a COMInterop assembly on a 32-bit PC, but not on a 64-but one.

How can I instruct the installer to run regasm from the framework64 folder on a 64-bit PC?
I want to use the same installer on 32 and 64 bit PCs
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Regasm for COMInterop assembly on 64-bit PC

Hi,
How can I instruct the installer to run regasm from the framework64 folder on a 64-bit PC?
I'm not sure how you are currently running "regasm.exe". However, you can make sure that the correct version of "regasm.exe" is used by specifying its exact path. In order to find its installation path on the target machine you can use a search.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
DevMountain
Posts: 9
Joined: Mon Feb 04, 2008 11:44 am

Re: Regasm for COMInterop assembly on 64-bit PC

It is being run automatically by the installer.

I have set the option 'Auto register file' and 'Register .Net assembly for COM Interoperability' for the DLL in the 'Files and Folders' section of AI.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Regasm for COMInterop assembly on 64-bit PC

Hi,

Please note that the built-in feature uses the "regasm.exe" file you specified in the "Options" -> "Tools" menu in Advanced Installer. Another solution is to create a custom action which register the file. Here are the steps:
- go to the Search page
- create a search for the 64-bit "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 64-bit 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).

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
DevMountain
Posts: 9
Joined: Mon Feb 04, 2008 11:44 am

Re: Regasm for COMInterop assembly on 64-bit PC

The "Launch File or Open URL" option only allows for the selection of an EXE - not the specification of a search variable.

Also, how can I distinguish between 64 and 32 bit? The 64 bit PCs here have 32 and 64 bit frameworks on, so the search may will find the 32-bit one first.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Regasm for COMInterop assembly on 64-bit PC

Hi,
The "Launch File or Open URL" option only allows for the selection of an EXE - not the specification of a search variable.
Please note that this custom action uses "viewer.exe" which is a tool designed for Advanced Installer. This tool will launch what you specify in the "Command Line" field of the custom action. Therefore, you can set the property of the search in the "Command Line" field manually or by using the "Edit..." button.
how can I distinguish between 64 and 32 bit?
For .NET Framework 2.0 the 32-bit version of "Regasm.exe" is installed in this folder:

Code: Select all

C:\windows\microsoft.net\Framework\v2.0.50727\regasm.exe
and the 64-bit version in this folder:

Code: Select all

C:\windows\microsoft.net\Framework64\v2.0.50727\regasm.exe
Since you need the 64-bit version of the file, you will search for it in the 64-bit folder. Note that the paths are different for other .NET Framework versions because they contain the actual version of .NET. Also, in the search you can use the [WindowsFolder] property. This will be resolved to the Windows installation folder ("C:\Windows" if the Windows OS is installed on C).

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
DevMountain
Posts: 9
Joined: Mon Feb 04, 2008 11:44 am

Re: Regasm for COMInterop assembly on 64-bit PC

Thanks for the first answer.

I understand the differences in the framework versions - how can I tell AI to not run the 64 bit regasm on 32 and vice versa - that was what the second part of my question is about.
Ionut
Posts: 605
Joined: Tue Nov 22, 2005 11:29 am
Contact: Website

Re: Regasm for COMInterop assembly on 64-bit PC

Hi,

You will create searches for both "Regasm.exe" versions (32-bit and 64-bit), as Cosmin has mentioned above. Name the search Properties REGASM32 and REGASM64, respectively.

On 32-bit systems, the search for the 64-bit Regasm will fail, since there is no "Framework64" folder present, and thus the value of the search Property REGASM64 will be empty. On 64-bit systems, both search Properties will have non-empty values, provided that the .NET Framework is installed.

Therefore, you could create 2 Custom Actions (following Cosmin's suggestions) and each of them will run a version of Regasm. These Custom Actions will have mutual exclusive Execution Conditions, such that only one of them will run.

The Custom Action that will run the 64-bit Regasm will have the Execution Condition set to:

Code: Select all

(REGASM64 <> "") AND (Not Installed)
while the Custom Action that will run the 32-bit Regasm will have the Execution Condition set to:

Code: Select all

(REGASM64 = "") AND (Not Installed)
Another option would be to use the VersionNT64 Property instead of REGASM64 to differentiate between 32-bit and 64-bit systems.

Hope this helps.

Regards,
Ionut
Denis Toma
Advanced Installer Team
http://www.advancedinstaller.com/
DevMountain
Posts: 9
Joined: Mon Feb 04, 2008 11:44 am

Re: Regasm for COMInterop assembly on 64-bit PC

Ionut - thanks that make perfect sense to me.

I will give it a try.

Thanks again to you both for your help.
DevMountain
Posts: 9
Joined: Mon Feb 04, 2008 11:44 am

Re: Regasm for COMInterop assembly on 64-bit PC

Just a quick note to says that it worked (of course!)

Thanks again
clintc
Posts: 3
Joined: Thu Jun 10, 2010 2:49 pm

Re: Regasm for COMInterop assembly on 64-bit PC

Hi there

Thanks for this advice. I have a quick question regarding custom actions and uninstalling: if my custom action modifies the registry (like this suggested use to regasm an assembly for COM), does the uninstall remove the registry keys that were added during installation?

Thanks,
Clint
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Regasm for COMInterop assembly on 64-bit PC

Hi Clint,

No, the uninstall will not remove the registry entries created by your custom action automatically. What you need is another custom action
scheduled to run only during uninstall to remove those entries. For a custom action to run only during complete uninstall of the application you need to set the following condition:

Code: Select all

REMOVE=ALL
Please let us know if you have other questions.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
clintc
Posts: 3
Joined: Thu Jun 10, 2010 2:49 pm

Re: Regasm for COMInterop assembly on 64-bit PC

Hi there

I'm having a problem using the Framework64 version of RegAsm to register a managed assembley for COM on a 64-bit machine: the CLSID keys are being created in the Wow6432Node.

1. In my AI project, I have a search named "REGASM64_NET20" which correctly locates RegAsm in "[WindowsFolder]Microsoft.NET\Framework64\v2.0.50727"
2. I have a custom action in the InstallExecuteSequence, which looks like this: [REGASM64_NET20] "[#MyManagedAssembly.dll]" /codebase /verbose
3. However the install is writing these keys to the Wow6432Node of the registry; I find that when I run this RegAsm from the command prompt on the 64-bit machine, it correctly installs the keys to the 64-bit parts of the registry.

My AI project has some keys in the Registry section.

Could it be that the viewer.exe process runs as a 32-bit process on a 64-bit machine (under Wow64)? Any help is appreciated.

Thanks,
Clint
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Regasm for COMInterop assembly on 64-bit PC

Hi Clint,
Could it be that the viewer.exe process runs as a 32-bit process on a 64-bit machine (under Wow64)?
This is exactly what is happening. He have created a a 64 bit version of our predefined custom action, unfortunately this will be available in version 8.1 of Advanced Installer (version 8.0 will be released in a couple of days).

Until then the solution is to create your own 64 bit launcher and add it as a "New Attached Custom Action".

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
bjk68
Posts: 55
Joined: Tue Dec 01, 2009 12:45 pm

Re: Regasm for COMInterop assembly on 64-bit PC

Bogdan wrote:Until then the solution is to create your own 64 bit launcher and add it as a "New Attached Custom Action".
Hi Bogdan,

Maybe you could make your 64 bit version of viewer.exe available for download while we are waiting for AI 8.1.

Regards,
Bart

Return to “Common Problems”