This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Let installshield registrate my .NET DLL instat of running Regasm.
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 30, 2008
05:45 AM
Let installshield registrate my .NET DLL instat of running Regasm.
Hi,
I found a lot of people with the same problem as me but i haven't found the solution that works.
I have a VB6 application that uses a .NET DLL. I already know that if i want to use this DLL in my application i have to generate a TLB key file(witch is done by VS2005), and then registrate the DLL with the command line: "Regasm MyDLL.dll /tlb: MyDLL.tlb".
My installer also has to registrate the DLL on the target machine. So i made the installer, added my files (MyApp.exe, MyDLL.dll and MyDLL.tlb) then went in the "Installation Designer" to the tab "Components" under "Organization". Selected the "MyDLL.dll" file and set ".NET COM Interop" to "Yes".
Then i build the installer and tried to install it on a clean PC.
While installing the error: "Error 1904. Module ~\MyDLL.dll failed to register. HRESULT -2147220473. Contact your support personnel." And after that the application does not work.
Now i don't know what to do. I know i could make a batch file that registrates the DLL for me and than add it as a custom action, there are only 2 problems with that: 1. I don't know how to make the custom action and 2. When uninstalling, it does not undo the registration of the DLL.
Could somebody please give me a descent solution for this problem? With descent i mean not to cryptic like all the other posts i already found.
OR: Is there a solution for this problem?
I found a lot of people with the same problem as me but i haven't found the solution that works.
I have a VB6 application that uses a .NET DLL. I already know that if i want to use this DLL in my application i have to generate a TLB key file(witch is done by VS2005), and then registrate the DLL with the command line: "Regasm MyDLL.dll /tlb: MyDLL.tlb".
My installer also has to registrate the DLL on the target machine. So i made the installer, added my files (MyApp.exe, MyDLL.dll and MyDLL.tlb) then went in the "Installation Designer" to the tab "Components" under "Organization". Selected the "MyDLL.dll" file and set ".NET COM Interop" to "Yes".
Then i build the installer and tried to install it on a clean PC.
While installing the error: "Error 1904. Module ~\MyDLL.dll failed to register. HRESULT -2147220473. Contact your support personnel." And after that the application does not work.
Now i don't know what to do. I know i could make a batch file that registrates the DLL for me and than add it as a custom action, there are only 2 problems with that: 1. I don't know how to make the custom action and 2. When uninstalling, it does not undo the registration of the DLL.
Could somebody please give me a descent solution for this problem? With descent i mean not to cryptic like all the other posts i already found.
OR: Is there a solution for this problem?
(3) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 30, 2008
11:07 AM
The success of using the NetComInterop functionality in the InstallShield IDE requires that the .Net .dll in question was compiled correctly. In Visual Studio 2003, it was necessary to set the ClassID, InterfaceID, and EventsID in the top of the class of the .Net project, as well as making sure that the project properties had "Make Assembly COM-Visible" selected.
The Studio 2003 method will not work in Studion 2005. In Visual Studio 2005, use the 'com class' template that comes with vs2005 to generate the guid's.
See: http://weblogs.asp.net/psteele/archive/2006/04/11/442524.aspx
If the .Net object is built correctly for COM interop, it is not necessary to include the .tlb file with the .dll in the installation package. Setting the "NetComInterop" property to "Yes" will work.
We had some older projects where we were running an InstallScript custom action to register the .Net .dll. In these we always installed the .dll and .tlb files to the target machine and as a last action, ran the regasm.exe utility to set it, passing it the /tlb /codebase parameters. We have removed this from most all projects now, seeing that it is not needed when the .dll is correctly compiled.
The Studio 2003 method will not work in Studion 2005. In Visual Studio 2005, use the 'com class' template that comes with vs2005 to generate the guid's.
See: http://weblogs.asp.net/psteele/archive/2006/04/11/442524.aspx
If the .Net object is built correctly for COM interop, it is not necessary to include the .tlb file with the .dll in the installation package. Setting the "NetComInterop" property to "Yes" will work.
We had some older projects where we were running an InstallScript custom action to register the .Net .dll. In these we always installed the .dll and .tlb files to the target machine and as a last action, ran the regasm.exe utility to set it, passing it the /tlb /codebase parameters. We have removed this from most all projects now, seeing that it is not needed when the .dll is correctly compiled.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 03, 2008
04:45 AM
ITI_Randy wrote:
The success of using the NetComInterop functionality in the InstallShield IDE requires that the .Net .dll in question was compiled correctly. In Visual Studio 2003, it was necessary to set the ClassID, InterfaceID, and EventsID in the top of the class of the .Net project, as well as making sure that the project properties had "Make Assembly COM-Visible" selected.
The Studio 2003 method will not work in Studion 2005. In Visual Studio 2005, use the 'com class' template that comes with vs2005 to generate the guid's.
See: http://weblogs.asp.net/psteele/archive/2006/04/11/442524.aspx< this is a VB.NET example, do you have one in C#?
If the .Net object is built correctly for COM interop, it is not necessary to include the .tlb file with the .dll in the installation package. Setting the "NetComInterop" property to "Yes" will work.
We had some older projects where we were running an InstallScript custom action to register the .Net .dll. In these we always installed the .dll and .tlb files to the target machine and as a last action, ran the regasm.exe utility to set it, passing it the /tlb /codebase parameters. We have removed this from most all projects now, seeing that it is not needed when the .dll is correctly compiled.
Thanks for replying...
As far as i know my DLL is compiled in the correct way. I cannot find the ClassID, InterfaceID, and EventsID attribute, as for the "Make Assembly COM-Visible" option. These are the things i did do to my code:
- Created Interfaces for each Com-Class and let the class inherit from them.
- Added the attribute [ComVisible(true)] to each Interface/Class i want to publish.
- Added a unique GuidAttribute to each Interface/Class.
- Added a ProgId attribute to each Class.
- Added the [InterfaceType(ComInterfaceType.InterfaceIsDual)] to each interface.
- Added the [ClassInterface(ClassInterfaceType.None)] to each Class.
- Checked the "Register for COM interop"-check in the properties of the project.
- Set the ComVisible attribute in the AssamblyInfo.cs to True.
Am i overlooking something?
What i also don't get is how you can only add the DLL to your installer. In my VB6 project i connect to the .tlb file, i thought this was the COM Wrapper needed to link Unmanaged code to Managed code.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 03, 2008
08:38 AM
Hello Willempipi,
For an excellent example in C# and a more detailed explanation, please see CodeSmith Code Generator at:
http://codebetter.com/blogs/peter.van.ooijen/archive/2005/08/02/130157.aspx
If the project is compiled correctly, an appropriate .tlb file will be generated for you when you build your InstallShield release.
For an excellent example in C# and a more detailed explanation, please see CodeSmith Code Generator at:
http://codebetter.com/blogs/peter.van.ooijen/archive/2005/08/02/130157.aspx
If the project is compiled correctly, an appropriate .tlb file will be generated for you when you build your InstallShield release.