all groups > dotnet clr > august 2003 >
You're in the

dotnet clr

group:

Maintaining multiple assembly versions withtout using the GAC


Maintaining multiple assembly versions withtout using the GAC Robert Myhill
8/27/2003 10:04:46 AM
dotnet clr:
Say I have
Foo.dll [Version 1.0.0.0, culture=null, public key token=ABC]
Foo.dll [Version 2.0.0.0, culture=null, public key token=ABC]
The second Foo.dll is a new major revision of the first Foo.dll.

And I don't want to privately deploy these assemblies, so they do not go in
the GAC. But I want to make both versions available to users.

Are there conventions for how (i.e. in what directories) these two
assemblies should be stored on a server, e.g. for no-touch deployment?
Also, are there conventions for how (i.e. in what directories) these two
assemblies should be stored on a client machine under the application's
directory (i.e. in a directory or sub-directory of where c:\MyApp\Myapp.exe
lives)?

It seems like having different versions of the same assembly makes things
more difficult, when you're not using the GAC. Do you have to create
directory structures that have version numbers in them, for the purposes of
storing the different versions of the assembly?

Related question in a different scenario: If version Foo.dll 1.0.0.0 is
downloaded from a web server into the download cache, and then, say, Foo.dll
2.0.0.0 overwrites Foo.dll 1.0.0.0 in the same location on the web server,
the next time MyApp.exe references Foo.dll, will the download cache
recognize that there is a new Foo.dll on the server, and download the new
one into the download cache?

Re: Maintaining multiple assembly versions withtout using the GAC Marcelo Birnbach [MS]
8/28/2003 3:19:04 PM
Hi Robert,

If your assembly Foo.dll is strongly named then your application MyApp.exe
will be able to reference and use only the assembly you used to compile. So,
I don't understand very well what you mean with 'I want to make both
versions available to users'. Do you mean that different applications will
use different versions of your component?

Thanks,
Marcelo

[quoted text, click to view]

Re: Maintaining multiple assembly versions withtout using the GAC Robert Myhill
8/29/2003 8:05:26 AM
Hi Marcelo,

Thanks for the reply.

First, I should say that I made a typo in my first posting. It should say
"And I do [I had said "don't"] want to privately deploy these assemblies,
so they do not go in
the GAC...". This re-wording obviously changes the intent of the message.

So, the situation is that I have two versions of the same assembly
(Foo.dll), and
I want to privately deploy (i.e. not in the GAC) both versions of the
assembly on a machine.
Does this simply not make sense, since, as you say, MyApp.exe can only
reference one of
the assemblies anyway, since MyApp.exe would have been built against only
version of the
assembly?

The above sounds correct if the code in MyApp.exe is doing Assembly.Load's.
But, in theory,
couldn't the code for MyApp.exe do:
Assembly.LoadFrom:("C:\\MyApp\1.0\Foo.dll");
and also do
Assembly.LoadFrom:("C:\\MyApp\2.0\Foo.dll");

(Where these are two different versions of the same Foo.dll assembly).
Would this work, if I wanted the same application to simultaneously use two
versions of
the same assembly? Or, does the CLR not allow this.

Thanks for your help.

Robert




[quoted text, click to view]

Re: Maintaining multiple assembly versions withtout using the GAC Kumar Gaurav Khanna [.NET MVP]
8/29/2003 8:00:22 PM
Hi!

Yes, this will work perfectly fine. However, the question is that if v2.0 is
a better version over v1.0, logically, why would you want to load both the
versions.

Also, remember that when you Assembly.LoadFrom, you dont have a compile time
reference to the classes being consumed, and developing this way is kind of
analogous to writing late bound code.

Is that what you are looking for?

--

Regards,
Gaurav Khanna
----------------------------------------------------------------------------
----------------
Microsoft MVP - .NET, MCSE Windows 2000/NT4, MCP+I
WinToolZone - Spelunking Microsoft Technologies
http://www.wintoolzone.com/
[quoted text, click to view]

AddThis Social Bookmark Button