locked
Can .NET 3.5 assemblies be mixed with .NET 40 Client Profile assemblies RRS feed

  • Question

  • We would like to deploy our application targeting the .NET 4.0 Client profile because I believe it is now deployed on most Windows 7 PCs. Some of the components we use do require .NET 4.0 so its not possible to use .NET 3.5 and we don't wish to force uses to install the full .NET framework if possible. (The pieces that require .NET 4.0 don't require the full framework, just the client profile)

    However some pieces of our code base require System.web which isn't in the 4.0 client profile, so I would like to package some 3.5 targeted assenblies along with 4.0 Client profile assemblies. Again the sole purpose is to not have users need to install the full .Net 4.0 framework since this is not installed on users PC's by default.

    However when I try and build my app, I get linkage errors of the kind:
    The type or namespace name 'XXXX' could not be found (are you missing a using directive or an assembly reference?) C:\....\WpfMixedAssemblies\WpfMixedAssemblies\MainWindow.xaml.cs

    (If both assemblies target the same runtime then naturally its fine)

    Any 'work arounds' would be much appreciated. E.g. is it possible to dynamically load assemblies targeted for another runtime in to the parent process?

    • Moved by Andrew.Wu Monday, March 28, 2011 7:17 AM (From:.NET Framework Setup)
    Friday, March 25, 2011 3:14 AM

Answers

All replies

  • Hi Henry Turtle,

    I'm going to move your post to the Common Language Runtime forum for more efficient response.

    Thanks for your understanding.

    Best Regards,


    Andrew Wu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, March 28, 2011 7:17 AM
  • Hi Henry,

     

    Welcome to the MSDN forum!

     

    .NET Framework 3.5 uses CLR 2.0 that is different from .NET Framework 4.0 which uses CLR 4.0.

    Fortunately, .NET Framework 4.0 supports to Load several versions of CLR in one process. You can forces to load CLR 2.0 when you using assembly via CLR’s Hosting API: Creating a host application for the .NET Common Language Runtime or Host CLR.

     

    I hope this can help you resolve your problem.


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Paul Zhou Friday, April 1, 2011 3:43 AM
    Monday, March 28, 2011 7:50 AM