Assembly.LoadWithPartialName, what's so bad about it?

I was wondering why LoadWithPartialName has been deprecated, anyone know
If I have multiple versions of MyAssmbly.dll in the GAC for example and I want my app to load the latest version, LoadWithPartialName does the trick.
What's the alternative now it's been deprecated in .NET 2.0


Answer this question

Assembly.LoadWithPartialName, what's so bad about it?

  • prog

    Thanks.
    The points she makes are valid in some situations, but not others. They shouldn't have deprecated it.
    I develop a "core" application that installs assemblies 3rd party apps can use into the GAC.
    In the code of my core app, I am dynamically loading some of its assemblies. If I then release a patch for this core application to update one of the GAC assemblies, I want my application to load this new assembly.
    Using LoadWithPartialName works fine for this.
    When I release a patch, I hardly want to have to recompile it all and ship the whole lot again just so it uses the newer assembly.
    So the long and short of it is, I'm ignoring the compiler warning and continuing to use LoadWithPartialName because it's useful.

  • David77

    Here's an explanation why you shouldn't use it: http://blogs.msdn.com/suzcook/archive/2003/05/30/57159.aspx



  • Bagles1

    Can't you keep the same assembly version in the patched assembly That's what Microsoft are doing for .NET Fx hotfixes and service packs. See http://blogs.msdn.com/suzcook/archive/2003/05/29/57148.aspx



  • axl

    Very interesting point.

    I've just automatically thought to change the assembly version for patched assemblies, and I haven't really differentiated between file version and assembly version.

    I assume Windows Installer will obey file overwrite rules looking at the file version, so the assembly will actually be overwritten when installing a patch.

    That's actually a pretty good idea, thanks.


  • Assembly.LoadWithPartialName, what's so bad about it?