locked
Assembly.Load strange behavior RRS feed

  • Question

  • 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, from the GAC).

    How can you explain this?


    http://webservices20.blogspot.com/
    WCF Security, Performance And Testing Blog
    Wednesday, December 30, 2009 5:09 PM

Answers

  • That machine must have a publisher policy file in place redirecting the old version to the 2.0.3.0 version.  This allows component publishers to redirect requests of older assemblies to a newer, fixed version (with the same binary compatible API).

    For details on how this works, see this page within How the Runtime Locates Assemblies.
    Reed Copsey, Jr. - http://reedcopsey.com
    • Marked as answer by Yaron Naveh Wednesday, December 30, 2009 9:00 PM
    Wednesday, December 30, 2009 6:20 PM