Summary
This article provides information about .Net assembly registration when installing setups using Windows Installer and RegAsm.exe.
Synopsis
This article is intended to provide information on working with .Net assembly registration when installing setups using Windows Installer.
Discussion
The Assembly Registration tool reads the metadata within an assembly and adds the necessary entries to the registry, which allows COM clients to create .NET Framework classes transparently. When you register an assembly for use by COM, Regasm.exe adds entries to the registry on the local computer.
Under normal use of InstallShield during the build process, InstallShield calls the Microsoft file RegAsm.exe on the .NET .dll to create a registry (.reg) file. This occurs when the .NET COM Interop property in the component is set to 'Yes'. During build a .reg file is created and the .reg file is imported. The resulting registry entries are then stored in the Registry table of the MSI database.
Using custom code to manually execute the RegAsm.exe tool to register the assembly involves more than one version of this tool based on Operating System:
C:\Windows\Microsoft.NET\Framework\<FrameWorkVersion>\RegAsm.exeC:\Windows\Microsoft.NET\Framework64\<FrameWorkVersion>\RegAsm.exe
Please refer to .NET functionality RuntimeEnvironment.GetRuntimeDirectory() static method in an effort to return the FrameWorkVersion number and/or the path of the common language runtime.
In the event custom actions to call RegAsm.exe are not possible consider creating the Reg file outside of InstallShield as a pre-build process and consume the resulting Reg file at build. The Microsoft article Regasm.exe (Assembly Registration Tool) describes what switch to pass on the cmd to create the Reg file. The Import REG File Wizard can be used to import a .reg file into a component or registry set, that registry data is added to the component?s or registry set´s registry data and written to the end user?s system if the component or registry set is installed.
Related Documents
Related KB Articles
Launch an Executable Using a Custom Action
Additional Information
An overview of steps involved include:
- Use the InstallScript method
LaunchApplication() in a custom action in a 64-bit installer while manifesting the setup.exe to provide Administrative Privilege is an approach to run the 64 bit version of RegAsm against the .Net assembly. - Ensure the .Net dll to be registered is managed code and COM visible.
- Include the resulting InstallScript Custom Action in the Execute sequence and set for Deferred Execution. In deferred mode system changes described by an internal installation script between the built-in actions InstallInitialize and InstallFinalize. Schedule the deferred action between InstallInitialize and InstallFinalize.
- Condition the action to run against x64 systems. A common Windows Installer property to use as the condition is:
VersionNT64. - Create, schedule, condition and maintain a similar custom action for the x86
RegAsm.exe.
Related Articles
Create 64 bit .NET Application for testing managed code custom action 3Number of Views Create a 64-bit Windows Registry Entry via an InstallScript Custom Action 9Number of Views Deleting a 64 bit Windows Registry Entry via an InstallScript Custom Action 5Number of Views HOW TO: Stop a Windows Service using a Custom Action 8Number of Views Launch an Executable Using a Custom Action 3Number of Views
Hi, I am Reva - Ask me anything.
No new updates
Thanks for the feedback!
Your feedback has been saved.Rate this response:
Add Additional feedback ( Optional )
Are you sure you want to cancel
the case creation?
Are you sure you want to cancel the case creation?
Are you sure you want to close this case
| Products | Region | Phone Numbers |
|---|---|---|
| FlexNet Operations FlexNet Embedded FlexNet Publisher FlexNet Connect FlexNet Code Insight InstallAnywhere InstallShield |
North America * |
+1 630-332-2513 (toll) +1 877-279-2853 (toll-free in North America) |
| Europe * |
+44 1925 944367 (toll) +44 800 047 8642 (toll-free in Europe) |
|
| Japan * | +81 3-4540-5335 (select option 2) | |
| Australia * |
+61 3 9895 2177 +61 1800 560 603 (toll-free in Australia) |
|
|
Usage Intelligence (formerly
Revulytics) Compliance Intelligence |
Please use the Case Portal to submit your support ticket or reach out to your Revenera contact. | |
Case id: 00001065
Activity: Status change: 2 hours ago