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
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" <iturn...@hotmail.com> wrote in message
news:#xXCyGL7BHA.2016@tkmsftngp03...
I have not had much luck with DCOM yet, even using COMREG.
Waldyn Benbenek
"Falk Schneider" <f.sch...@dasgip.de> wrote in message
news:#gj9GAT7BHA.2112@tkmsftngp02...
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" <f.sch...@dasgip.de> wrote in message
news:#gj9GAT7BHA.2112@tkmsftngp02...