CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2002
    Posts
    146

    interoperability .net 2.0 & .net 4.0

    Hi all,
    is it possible to call some methods of a class library developed with .net framework 4.0 in an application developed by using .net framework 2.0?

    Many thanks,
    Francesco

  2. #2
    Join Date
    Dec 2007
    Posts
    234

    Re: interoperability .net 2.0 & .net 4.0

    As long as 4.0FW was installed... I don't see why not... Good question... never occurred to me. I've gone the other way, where a 3.5 object called into 2.0, and that worked, I guess I kind of assumed that it would work going upwards too... I'll have to try that later.

    -tg
    * I don't respond to private requests for help. It's not conducive to the general learning of others.-I also subscribe to all threads I participate, so there's no need to pm when there's an update.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help - how to remove eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to???
    * On Error Resume Next is error ignoring, not error handling(tm). * Use Offensive Programming, not Defensive Programming.
    "There is a major problem with your code, and VB wants to tell you what it is.. but you have decided to put your fingers in your ears and shout 'I'm not listening!'" - si_the_geek on using OERN
    MVP '06-'10

  3. #3
    Join Date
    Jun 2010
    Posts
    85

    Re: interoperability .net 2.0 & .net 4.0

    no it is not possible your manifest defines the version of the dlls that are required to run your application. If those dlls are not present the application will not run.

  4. #4
    Join Date
    Dec 2007
    Posts
    234

    Re: interoperability .net 2.0 & .net 4.0

    True... if FW4.0 isn't installed on the system, there shouldn't be an expectation that it would run.... BUT... if FW4.0 IS installed...

    -tg
    * I don't respond to private requests for help. It's not conducive to the general learning of others.-I also subscribe to all threads I participate, so there's no need to pm when there's an update.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help - how to remove eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to???
    * On Error Resume Next is error ignoring, not error handling(tm). * Use Offensive Programming, not Defensive Programming.
    "There is a major problem with your code, and VB wants to tell you what it is.. but you have decided to put your fingers in your ears and shout 'I'm not listening!'" - si_the_geek on using OERN
    MVP '06-'10

  5. #5
    Join Date
    Jul 2002
    Posts
    146

    Re: interoperability .net 2.0 & .net 4.0

    Yes of course, I have installed both .net 2.0 and .net 4.0.
    My question is about the use of a .net 4.0 class library.
    If I add a reference to that class library in a .net 2.0 application an error occurs.

  6. #6
    Join Date
    Dec 2007
    Posts
    234

    Re: interoperability .net 2.0 & .net 4.0

    Well, then that should be your answer right there. It would seem that the answer is "no, you can't."

    Just out of curiosity, what is the error you get?

    -tg
    * I don't respond to private requests for help. It's not conducive to the general learning of others.-I also subscribe to all threads I participate, so there's no need to pm when there's an update.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help - how to remove eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to???
    * On Error Resume Next is error ignoring, not error handling(tm). * Use Offensive Programming, not Defensive Programming.
    "There is a major problem with your code, and VB wants to tell you what it is.. but you have decided to put your fingers in your ears and shout 'I'm not listening!'" - si_the_geek on using OERN
    MVP '06-'10

  7. #7
    Join Date
    Sep 2008
    Location
    Netherlands
    Posts
    865

    Re: interoperability .net 2.0 & .net 4.0

    If I'm correct (not 100% sure), you can't run .NET 2.0 DLLs in your .NET 4 application because they use a different CLR. .NET 2.0 uses the CLR 2.0 and .NET 4 uses the CLR 4.

    You can use .NET 3.5 in a .NET 2.0 app because .NET 3.5 also uses the CLR 2.0.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured