Rebuilding a GAC Strong Name assembly DLL

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

Hello

I've created a DLL (Common.dll) that needs to be used by multiple .NET
Windows applications. So I thought the best solution would be to deploy the
DLL into the GAC after associating it with a Strong Name.

But I've noticed a problem.
If I build a Windows Application that references the Common.DLL it all works
fine.
But if I then rebuild the Common.DLL and copy the new Common.DLL into the
directory where the Windows Application EXE was built (overwriting the
previous Common.DLL) the Windows Application EXE no longer works.

I think this is due to the version number changing in the strong named
Common.DLL. Initially the AssemblyVersion attribute was set to 1.0.*, so I
tried setting it to 1.0.0.0 and building a new Common.DLL. Then I rebuilt the
Windows Application EXE against version 1.0.0.0 of Common.DLL. But if I built
version 1.0.0.1 of the Common.DLL and copied it into the same directory as
the Windows Application EXE, the Windows Application EXE no longer works.

This is a big problem for me.
If I need to make a change to the Common.dll and rebuild it, I don't want to
also rebuild all the applications that reference the Common.DLL. I just want
to be able to make changes to the Common.DLL, deploy it to the GAC and all
the applications that reference the Common.DLL, use the new Common.DLL.

Is this possible?

Thank you for your help

Mark
 
Hi Mark,

When you reference a dll with a strong name the reference is to the
strongname itself, which includes the version number.

You could rebuild the Common.dll with the same version number and provided
you have not broken the interface, then your windows application should work
just fine with the new version.

The other option is a redirect policy.

You would install the redirect policy into the GAC when you install your new
version of the dll which would redirect any applications that reference the
older version to point to the newer version.

Also, you mentioned copying the dll into the same folder as the windows exe.

I could be mistaken about this, but I think if you reference a strong named
file then the exe will always look in the GAC first before the local
directory, even with copy local set to true on the reference.

Hope this information helps.

--
Regards,

Phillip Johnson (MCSD For .NET)
PJ Software Development
www.pjsoftwaredevelopment.com
 
Back
Top