locked
AppDomains: .net version interop RRS feed

  • Question

  • Is it possible or reasonable to have multiple versions of .net framework loaded into seperate AppDomains of the same process?  And if yes, what is the best way to have those AppDomains talk to eachother?  Right now, the only barely working way I know of two interoperate multiple .net versions - is through web service calls. 

     

    Feel free to discuss any .net framework pairing sceneario (2.0 with 1.1, or 3.0 with 2.0, I don't care....)

    Monday, March 17, 2008 10:26 PM

Answers

  • Dear Brent,
    You can run a 1.1 application under 2.0 (2.0 is backward compatible with 1.1). Of course there are some things changed that might break your code, but you could only update those, instead having to upgrade the whole application, especially if it's a legacy app. You can do this easily if you are on web (just change the IIS Application to run on .NET 2.0 instead of 1.1).
    If you are on Desktop you might need to create manifests for the assemblies in your project to force them to run on the wanted version of .NET Framework.
    --Edit 1
    There might be some problems if you serialize using BinaryFormatter from what I remember

    --Edit 2
    Anyway, there must be a list with the differences between the frameworks somewhere on MSDN.
    Also, 3.0 is backward compatible with 2.0 and 3.5 is also backward compatible.
    From what I remember, they've broken (MS) the compatiblity only between 1.0 and 1.1

    Hope this answers your problem.
    Wednesday, March 26, 2008 10:14 AM

All replies

  • Is this at the server or at client desktops?

     

    If it is a server component, why spend time in during interop?  Can you host them on virtual machines and slowly migrate the functionality to a version till the critical mass resides in one version?

    Monday, March 17, 2008 11:35 PM
  • I'm dealing with a server written in 1.1, using newer functionality written in 2.0.  It is really cumbersome to make web invocations for no other purpose but to provide interop between framework versions.  It would be nice if there were other ways to accomplish this, such as multiple versioned AppDomains.  But from what I've found of my research so far, that isn't possible (all AppDomains in a process must be the same version of .net)

     

    Monday, March 17, 2008 11:46 PM
  • Ah, I'm glad I asked that question.

     

    I don't know if it would help you, but you should possibly consider upgrading the 1.1 stuff to 2.0, then use binder redirection if there are existing clients using it, to point the 1.1 assembly calls into the backwards compatible 2.0 upgraded code?  As far as I'm aware, this is an all or nothing situation, and unless they're in seperate processes will not work.  It's an interesting question though, and I may be wrong, but it feels to me like a hack to try to make both work together personally.

     

    My advice would definitely be to upgrade the 1.1 code to using 2.0 framework, then build from there.  There shouldn't be any problems with the upgrade although you would need to do the redirecting to the new assemblies, or possibly keep the original code, and GAC up a new version with all the 1.1 functionality and new 2.0 functionality in it, for new clients to point to, thus maintaining backward compatibility.

     

    I hope this helps, or at least gives you some other things to search on,

     

    Martin Platt.

    Monday, March 17, 2008 11:56 PM
  • Dear Brent,
    You can run a 1.1 application under 2.0 (2.0 is backward compatible with 1.1). Of course there are some things changed that might break your code, but you could only update those, instead having to upgrade the whole application, especially if it's a legacy app. You can do this easily if you are on web (just change the IIS Application to run on .NET 2.0 instead of 1.1).
    If you are on Desktop you might need to create manifests for the assemblies in your project to force them to run on the wanted version of .NET Framework.
    --Edit 1
    There might be some problems if you serialize using BinaryFormatter from what I remember

    --Edit 2
    Anyway, there must be a list with the differences between the frameworks somewhere on MSDN.
    Also, 3.0 is backward compatible with 2.0 and 3.5 is also backward compatible.
    From what I remember, they've broken (MS) the compatiblity only between 1.0 and 1.1

    Hope this answers your problem.
    Wednesday, March 26, 2008 10:14 AM