Page 1 of 1

DLL registration

Posted: Tue Aug 16, 2005 10:48 am
by AndrewM
Hello

Just tryng out InstallAware 2005 and I am wondering about DLL registration. There is a dialog that lists a file's properties. I am looking for clarification as to the "File is Self-Registering" option. Am I to assume that if I check this option, the DLL is NOT a COM dll and regsvr32 will NOT be called, or is it the opposite?

Thanks and great interface BTW!

Andrew

Posted: Tue Aug 16, 2005 12:40 pm
by sinan
Andrew

Thanks for the enthusiastic post :lol:
If you check the selfreg option, file will be self regged by Windows Installer, but it has to be a self registering file.
If you need more flexible behavior, like specifying the order/timing of self registration, then I recommend you use the Register Library command, instead of the Install Files command's option which is rather limited (by design in Windows Installer).

Sinan

Posted: Wed Nov 30, 2005 5:28 pm
by Nick
I'm also just trying out InstallAware 2005. I have a similar problem, I have an assembly that I must put in the GAC which also needs to be registered.

When I add the file to the assemblies tab and specify to add it to the GAC I can no longer have the option to declare it as self-registering in the Edit dialog.

I've looked at the code and cannot find a way to RegisterLibrary where the library is in the GAC.

In my VS 2003 installer project I solved this by writing my own Installer class and having that called OnCommit, OnUninstall, OnCommit. Using self-reg was actually not registering it correctly. Is there a way to use the Installer class I wrote with InstallAware?

Posted: Wed Nov 30, 2005 5:44 pm
by sinan
How did your class actually solve this problem?

Posted: Wed Nov 30, 2005 6:51 pm
by Dana Epp
The way I got around this was to call regasm.exe directly through the "Run Program". Since regasm is not located in the path, you need to explicitly set it. In my case I didn't want to copy it to the GAC but instead leave it in the $TARGETDIR$ install dir.

Here is the settings I used:

Run Program: $WINDIR$\\Microsoft.NET\\Framework\\v1.1.4322\\regasm.exe

Check "Hide Program Window"

Command Line: "$TARGETDIR$\\mycode.dll" /silent /codebase

Check "Wait for Program to Finish"

That works. Before removing the file, on uninstall I call the same regasm.exe but use the command line of:

"$TARGETDIR$\\mycode.dll" /silent /unregister

Hope thats helpful. Good luck.

Posted: Mon Dec 05, 2005 2:49 pm
by Nick
The installer class, which is derived from System.Configuration.Install.Installer basically does the regasm steps but loads the dll from the GAC.

The workaround that Dana posted will essentially do what I need except I need to be able to do the registration on the dll installed in the GAC not the targetdir. I could copy the dll in question to the targetdir as well and do a regasm on it but that is not very clean.

The OnCommitted() call code is below:
----------------------------------------------------
Assembly deskBarAssembly
{
get
{
return AppDomain.CurrentDomain.Load(.....);
}
}

protected override void OnCommitted(System.Collections.IDictionary savedState)
{
try
{
base.OnCommitted(savedState);

RegistrationServices rs = new RegistrationServices();
rs.RegisterAssembly(
deskBarAssembly,
AssemblyRegistrationFlags.None
);

InvalidateExplorerBarsList();
}
catch(Exception e)
{
#if DEBUG
MessageBox.Show(e.ToString());
#endif
throw;
}
}

Posted: Tue Dec 06, 2005 7:49 am
by sinan
I believe when a file is loaded into the GAC you can specify the full name of the assembly as a parameter to regasm in order to register it. This is not the file path but the full assembly name including culture, etc...