DLL registration

Got a problem you cannot solve? Try here.
AndrewM
Posts: 2
Joined: Tue Aug 16, 2005 10:43 am

DLL registration

Postby AndrewM » Tue Aug 16, 2005 10:48 am

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

sinan
Site Admin
Posts: 1028
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Postby sinan » Tue Aug 16, 2005 12:40 pm

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

Nick
Posts: 30
Joined: Wed Nov 30, 2005 5:18 pm

Postby Nick » Wed Nov 30, 2005 5:28 pm

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?

sinan
Site Admin
Posts: 1028
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Postby sinan » Wed Nov 30, 2005 5:44 pm

How did your class actually solve this problem?

Dana Epp
Posts: 29
Joined: Wed Dec 01, 2004 2:27 pm

Postby Dana Epp » Wed Nov 30, 2005 6:51 pm

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.
---
Regards,
Dana Epp

Nick
Posts: 30
Joined: Wed Nov 30, 2005 5:18 pm

Postby Nick » Mon Dec 05, 2005 2:49 pm

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;
}
}

sinan
Site Admin
Posts: 1028
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Postby sinan » Tue Dec 06, 2005 7:49 am

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...


Return to “Technical Support”

Who is online

Users browsing this forum: Google [Bot] and 161 guests