Re: .NET versioning

Tech-Archive recommends: Fix windows errors by optimizing your registry



Richard Grimes wrote:

> Frans Bouma [C# MVP] wrote:
> > If that's the case, you could try to use assembly FILE versions
> > instead. This is also the technique Microsoft uses for hotfixes and
> > service packs on .NET: the version is the same (2.0.0.0) but the
> > file version value in the assemblyfileversion attribute changes.
> > You can install a file with a newer FILE version in the GAC even if
> > it has the same assembly version.
>
> This will work with hotfixes, because Microsoft know what they are
> doing, and anyway, they control the operating system. You *should
> not* do this yourself because it is a return to Win32 DLL Hell.
>
> The reason is that the new version will overwrite the old version.
> The GAC recognises only the .NET version, not the version in the
> VERSIONINFO unmanaged resource, so gacutil just thinks you are
> inserting the same assembly into the GAC and hence it overwrites
> what's there. (When you use gacutil it will put the file in a
> special folder with a name constructed line this: <.net
> version>_<culture>_<publickeytoken> and since these will be the same
> for both versions, the later one will over write the former.)

Isn't that the intention? You have version 1.0.0.0 and you have a
bugfix release. So you release a new version of the dll, same assembly
version. You copy the file into the gac, it overwrites the old one and
all your apps using the 1.0.0.0 version use now the bugfixes.

I said 'bugfixes' thus not new features.

> So you have two assemblies installed into the GAC and two uninstall
> processes, and yet there is only one physical file in the GAC. This
> means that after the first uninstall has been run all applications
> that remain that use this library will stop working. You can get
> around this issue with GAC references.

No install processes, you copy the files.

Uninstalling indeed removes the file, but that's not the point here.
The point is that with a bugfix you otherwise have to produce policy
files and / or recompiles.

> However, since this is just DLL Hell being applied to .NET, I would
> recommend that this 'solution' should not be used.

That's great but what's your 'solution' then? It's always nice to see
people saying "I Don't recomment this!!" and at the same time they
don't have an answer to the question: what to do instead?

Because if you sign your assemblies, and you simply use buildnumbers
for bugfixes, you have to use policy files to be sure everything keeps
on working, OR Recompile everything else.

policy files require an installer, while with fileversions you can
just drag/n/drop the dll into the gac and be done with it: for example
in the situation where you leave it to the user to store the dlls in
the GAC or keep them local to the application. So, for the users who
want the dlls in the gac (or need to, because of some issues with
fusion's loader, like Oracle's ODP.NET dlls can confuse the loader and
it suddenly forgets probing paths) they can simply add them to the gac,
and for the people who don't want to do that, they can simply avoid the
GAC altogether. After all, Microsoft themselves state that if you can
avoid the GAC you should.

FB



--
------------------------------------------------------------------------
Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
.



Relevant Pages

  • Re: How can I use a dll with several programs?
    ... with the GAC is the possibility of a new version of a .dll unintentionally ... Maintaining backwards compatibility of a .dll by keeping ... largely removed DLL Hell from the Windows programming radar. ... 50% based on incorrect registry entries and since .NET assemblies don't ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Public Key Specification When Referencing A Strong Named DLL
    ... up posting might be of benefit to some that are new to using the GAC ... DLL file into the proper GAC folder. ... reference the public key created using the sn.exe utility. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How can I use a dll with several programs?
    ... with the GAC is the possibility of a new version of a .dll unintentionally ... Maintaining backwards compatibility of a .dll by keeping its ... largely removed DLL Hell from the Windows programming radar. ... 50% based on incorrect registry entries and since .NET assemblies don't ...
    (microsoft.public.dotnet.languages.vb)
  • Re: FileNotFound exception
    ... I had to specify the physical location of the dll. ... of loading the dll through configuration file. ... Since it is in GAC I did not specify ... >> faliure to load the versioned assembly. ...
    (microsoft.public.dotnet.framework.remoting)
  • Re: GAC and Source Safe
    ... using GAC would be better option. ... You should also condider that .NET allows you to avoid 'dll ... version of libary with your app and not break anyone else. ... and put in the source safe. ...
    (microsoft.public.dotnet.framework.aspnet)