locked
Ramifications of mixing Net 4 and Net 3.5 assemblies RRS feed

  • Question

  • I'm experimenting with some existing assemblies of mine that target Net 3.5. I want to use them with a new application that targets Net 4. When I started I expected I would have to migrate these existing assemblies to target Framework 4 in order to use them with my Framework 4 app, and in fact did this. But I just discovered that I can toggle them back to target 3.5, leaving my main app at 4 and it all still builds and runs. Is this the "In-Process Side-by-Side Execution" feature I've heard about?

    So I am wondering what are the ramifications of what I am doing? Will I run into trouble? Will I encounter perf issues? Or does it simply come down to the fact that my app will require that both Net 3.5 (CLR2) and Net 4 be installed in order to run? Not ideal I recognize.

    The reason this setup is attractive to me is that I do not need to have two project files for each of those shared assemblies, one targeting 3.5 and the other 4. Keeping in mind I still have apps using those assemblies that are targeting 3.5.

    Thoughts?
    Wednesday, February 17, 2010 12:59 AM

Answers

All replies

  • It is the same as with a .NET 3.5 application which loads and uses 1.0 shared library. Only 3.5 will be loaded at that moment.
    In-proc SxS kicks in only when you have .NET 4.0 app using COM components which happen to be implemented in 3.5/3.0/2.0/1.x. Or if you do other similar tricks involving native components of your app.

    Read tis article for more info: http://msdn.microsoft.com/en-us/magazine/ee819091.aspx
    This is useful doc, but it is a little bit changed in 4.0 RC / RTM: http://blogs.msdn.com/clrteam/archive/2009/06/07/in-process-side-by-side-part-2-common-in-proc-sxs-scenarios.aspx

    -Karel
    Wednesday, February 17, 2010 1:49 AM
    Moderator
  • Ah, I see. I guess it had been so long since I had anything to do with Net 1.x that this whole topic has just not been an issue for me.

    So what it comes down to is that even though I am using assemblies that target Net 3.5, the fact that my app is Net 4 means the app will run within the Net 4 CLR, as will all of the assemblies that I reference (even those targeting Net 3.5).

    Thanks for the help Karel.
    Wednesday, February 17, 2010 3:15 AM