This message was discovered on microsoft.public.dotnet.framework.setup.
| Ian Turner |
| GOOD ANSWER |
Hi,
I've got a class library (c#) project that I need to register for COM (using the Register for COM Interop property and a Strong Name Key file). When I build the project in Visual Studio, it goes through the usual Unregistering for COM, Registering for COM and everything is fine and dandy.
However, when I create a Setup project and deploy that to another machine, the CLSID and PROGID registry entries are not created. The dll in question is being deployed into the Global Assembly Cache. If I manually run RegAsm from the command line, it adds the CLSID and PROGID (no codebase gets set - suggesting that it has found the assembly in the GAC).
Within the Setup project, I have set the register property of the primary output to vsdrpCOM expecting it to register the assembly.
So, does anyone know why this is not registering correctly? Or does the vsdrpCOM setting not actually do the COM registration after all.
Any help would be much appreciated.
Cheers Ian
|
|
|
| |
|
|
| |
| |
| Falk Schneider |
| GOOD ANSWER |
Same thing i figured out when registering a VB.Net library into COM for use with an VB6 server! - Seems to be a bug!?
Actually I couldn't find a way to deploy a solution to a production machine, though it works perfectly on the development system!!!
I would very much appreciate any help, too (...perhaps from MS!?)
Thanks Falk
"Ian Turner" <Click here to reveal e-mail address> wrote in message news:#xXCyGL7BHA.2016@tkmsftngp03... [Original message clipped]
|
|
|
| |
|
|
| |
| |
| Waldyn |
| GOOD ANSWER |
I have successfully registered a .NET server for COM outside of VS.NET. I used GacUtil and Regasm. I have also used COMREG (Framework interop sample), it will do the GAC install as well as the registration.
I have not had much luck with DCOM yet, even using COMREG.
Waldyn Benbenek "Falk Schneider" <Click here to reveal e-mail address> wrote in message news:#gj9GAT7BHA.2112@tkmsftngp02... > Same thing i figured out when registering a VB.Net library into COM for use [Original message clipped]
|
|
|
| |
|
|
| |
|
| |
| Ian Turner |
| GOOD ANSWER |
I've found a way of doing this that works fine for my requirements.
1. Add a new class to the Primary Ouput project, derived from System.Configuration.Install.Installer and mark the class with the System.ComponentModel.RunInstaller attribute 2. Override the Install and Uninstall methods and use the System.Runtime.InteropServices.RegistrationServices class to register and unregister the assembly. 3. Add Custom Actions to the Install and Uninstall phases of the setup project. Make sure both actions have the InstallerClass property set to true.
When the setup is executed, the Custom Actions will invoke the Installer derived class that you have added, and will do the registration / unregistration for you.
This is what my Installer class looks like in C#:
using System; using System.Configuration.Install; using System.ComponentModel; using System.Runtime.InteropServices;
namespace TestProject { [RunInstaller(true)] public class ComInstaller : Installer { public override void Install(System.Collections.IDictionary stateSaver) { base.Install(stateSaver);
RegistrationServices regsrv = new RegistrationServices(); if (!regsrv.RegisterAssembly(this.GetType().Assembly, AssemblyRegistrationFlags.SetCodeBase)) { throw new InstallException("Failed To Register for COM"); } }
public override void Uninstall(System.Collections.IDictionary savedState) { base.Uninstall(savedState);
RegistrationServices regsrv = new RegistrationServices(); if (!regsrv.UnregisterAssembly(this.GetType().Assembly)) { throw new InstallException("Failed To Unregister for COM"); } } } }
Cheers Ian
"Falk Schneider" <Click here to reveal e-mail address> wrote in message news:#gj9GAT7BHA.2112@tkmsftngp02... > Same thing i figured out when registering a VB.Net library into COM for use [Original message clipped]
|
|
|
| |
|
|
| |
| |
| Gregory Williams |
| GOOD ANSWER |
Just got to say that Ian Turner's solution works just great. Plus, it's a nice elegant solution! This has solved one of the major hurdles with releasing our updated VB6 / .net hybrid application internally.
Thanks, Ian!
-------------------------------- From: Gregory Williams
|
|
|
| |
|
|
| |
| |
| Adnan Siddiqi |
| GOOD ANSWER |
Hello
i am unable to call Uninstall method during Uninstallation.. what all I did that i made 2 seperate projects for both Install and Uninstall and add respective DLLs in INSTALL and UNINSTALL custom Actions,this is the code which i use for Uninstall and this is saved as seperate .dll file which then used in Custom Actions->Uninstall section
public override void Uninstall(System.Collections.IDictionary savedState) { //Remove XML FIle MessageBox.Show("i am in Uninstall","Config File"); if(File.Exists("c:\\_config.xml")) { File.SetAttributes("c:\\_config.xml",FileAttributes.Normal); File.Delete("c:\\_config.xml"); MessageBox.Show("File is Deleted","Config File"); } base.Uninstall(savedState); RegistrationServices regsrv=new RegistrationServices(); if (!regsrv.UnregisterAssembly(this.GetType().Assembly)) { throw new InstallException("Failed To Unregister for COM"); }
}
UNinstaller is not calling this method at all,kindly guide me,right now i am not sure that whether i need 2 seprate Dlls for 2 different custom actions(Install and Uninstall) or by putting both overridden methods in a single dll and then call them in "<b>Install</b>" and "Uninstall" Sections of <i>Custom Actions</i>?
|
|
|
| |
|
|
| |
|
|
|
|
|
|
|
|