Groups | Blog | Home
all groups > dotnet sdk > october 2007 >

dotnet sdk : GAC assembly deployment nightmare


phcmi
10/21/2007 12:26:11 PM
I've recently inherited a nightmare of a project. My predecessor created 18
assemblies where only 2 were necessary. These assemblies provide common
implementations for our 7 and growing applications, so he decided that the
deployment strategy is that each application will place all 18 into the GAC.
Since we do not deploy our applications as a suite, it is possible for each
application to prompt new features in these 18 common assemblies and it may
be months between application RTMs, this deployment strategy is severely
flawed. I've taken care of almost all of the deployment nightmare, automated
builds and other issues where these 18 assemblies are concerned but there's
one major pain that I haven't been able to solve yet.

Each application contains an app.config file where a <configuration>
section is defined for all 16 of the 18 assemblies ( because of dependencies
between 2 of the assemblies). Each entry in the section outlines the
assemblyname, version, key, etc.

Here's the nightmare, when an AssemblyVersion increment in any of these
assemblies occurs, each application's app.config file must also be updated
with the correct version information.

Is there some way to load an assembly from the GAC in a version-independent
way as is possible in COM? My strategy to solve the versioning issue is to
remove any versioning data in the applications' app.config file, then load
the latest or highest version of each of these assemblies at application
runtime. Is this possible? If so, can you outline or provide a sample that
outlines how to accomplish this?



wawang NO[at]SPAM online.microsoft.com (
10/23/2007 12:00:00 AM
Hi phcmi,

First, as you've already pointed out, GAC is usually used to support
side-by-side with different versions of shared assemblies. Your objective
here is really not the recommended way to always use latest version of an
assembly. Nevertheless, you can do that using publisher policy files:

#Junfeng Zhang's Windows Programming Notes : Publisher policy, redirection
cross major/minor version, and using the latest version
http://blogs.msdn.com/junfeng/archive/2005/07/13/438327.aspx
<quote>
People have taken advantage of this to re-use publisher policy for the
purpose of always-load-the-latest-version. Of course they have to ship
publisher policy for every major/minor version combination they ever have
shipped. For example, if they have shipped v1.0.0.0, v2.0.0.0, and
v3.0.0.0, and they want everyone to use v3.0.0.0, they will have to ship
publisher policies for v1.0 and v2.0 to redirect both v1.0 and v2.0 to
v3.0.

Apparently this is not something we recommend. But you can do it
nevertheless.
</quote>


References on publisher policy:

#Redirecting Assembly Versions
http://msdn2.microsoft.com/en-us/library/7wd6ex19(VS.80).aspx

#Using publisher policy assemblies
http://support.microsoft.com/kb/891030


Hope this helps.


Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Phil Wilson
10/24/2007 1:49:51 PM
Is this a case where each app should just install its own copy of a shared
assembly into each application's folder instead of the GAC? I'm wondering if
this is one of those cases where the GAC is a dumping ground for every
shared assembly in a similar way that the System folder used to be for Win32
shared Dlls.
--
Phil Wilson
[Microsoft MVP-Windows Installer]

[quoted text, click to view]

phcmi
10/24/2007 8:15:50 PM
Hi Phil,
Very astute observation. You are absolutely correct.
You of all people understand the build and certainly deployment nightmare
that result from poor or no planning.
Deploying to the GAC is the new System32 dumping ground "just get it to
work" approach.
There's an added bonus nightmare to the approach above, that most of the
novices out there can't even fathom.
The return of dll hell. Instead of dll hell however, the new hell is
versioning hell.
But of course I'm just stating what you already know.
Thanks for the input Phil.

[quoted text, click to view]

wawang NO[at]SPAM online.microsoft.com (
10/30/2007 3:06:20 AM
Hi phcmi,

I'm writing to check the status of this post. Please feel free to let me
know if there's anything else I can help. Thanks.


Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
AddThis Social Bookmark Button