views:

71

answers:

3

I have "Microsoft.Web.Services2.dll" V2.0.3.0 in my GAC of two machines.

I am running this line in both of them:

Assembly.Load("Microsoft.Web.Services2, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");

(note the version is 2.0.0.0 and not 2.0.3.0)

On one machine this fails (as I would expect). In another it works and the loaded dll is 2.0.3.0. Actually on this machine every version lower than 3 works (and loads 3).

How can you explain this?

A: 

Maybe you have Microsoft.Web.Services2.dll in your bin folder. Check the assembly location:

var assembly = Assembly.Load("XXX");
Console.WriteLine(assembly.Location);
Darin Dimitrov
no, it isn't there
Yaron Naveh
So what does the `Location` property equals to once the assembly loaded?
Darin Dimitrov
Regardless of the version (providing it is < 3) I as I get C:\Windows\assembly\GAC\Microsoft.Web.Services2\2.0.3.0__31bf3856ad364e35\Microsoft.Web.Services2.dll
Yaron Naveh
A: 

This might be related to loading a "Specific Version" flag. If you check the assembly properties in References folder in Visual Studio, it shows a "Specific Version" property which I think specifies whether to link to specific version of an assembly or not (default is false). By default, it will link to any specific OR newer version of the assembly and that whats happening here I guess.

So there might be some option in Load method itself that specifies whether to load the specific version ONLY or fall back to a more recent one if specific is not found.

A9S6
The assembly is not referenced at all - I load it from GAC. This is what is strange...
Yaron Naveh