CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2009
    Posts
    128

    Question problem accessing framework(2) dll in framework(4)

    i have a dll(C#) that is created in .NetFramework 2.0 but i am unable to access it in .NetFramework 4.0 (application) . do i have to make any settings in order to access the dll built in .NetFramework 2.0.

    but if i change my application to .NetFramework 2.0 then the dll(.NetFramework 2.0) works. How do i solve the problem ?
    Last edited by dskp; February 3rd, 2012 at 12:58 AM.

  2. #2
    Join Date
    Feb 2011
    Location
    United States
    Posts
    1,016

    Re: problem accessing framework(2) dll in framework(4)

    I'm not sure. I think it should be backward compatible, but have not tried this before. Perhaps others know, but to facilitate moving this question forward:

    (a) can you just upgrade the 2.0 assembly to 4.0?

    (b) What sort of error message are you getting?
    Best Regards,

    BioPhysEngr
    http://blog.biophysengr.net
    --
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  3. #3
    Join Date
    Nov 2009
    Posts
    128

    Re: problem accessing framework(2) dll in framework(4)

    Thanks a lot for the reply......

    a)can you just upgrade the 2.0 assembly to 4.0?
    Ans) unfortunately ,I am not suppose to upgrade the dll

    b) What sort of error message are you getting?
    Ans) I do not get any sort of error messages, i am not able to access the dll even if I add the reference of the dll (2.0)

  4. #4
    Join Date
    Feb 2011
    Location
    United States
    Posts
    1,016

    Re: problem accessing framework(2) dll in framework(4)

    So what happens if you target the .NET2.0 framework, compile (which presumably works), change nothing except targeting the .NET4.0 framework and re-compile (which presumably fails with an error message)?
    Best Regards,

    BioPhysEngr
    http://blog.biophysengr.net
    --
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  5. #5
    Join Date
    Nov 2009
    Posts
    128

    Re: problem accessing framework(2) dll in framework(4)

    In detail this is my Problem:

    I am trying to get the all the process modules from the Current process using "ProcessModuleCollection" Class. Please see the code i have used to do the above job. Before that I added a .net 2.0 my own dll to the project as reference. I am able to see that dll in process modules list from the below Code.

    So the problem is, when i added a .net 4.0 dll to the project of of same 4.0 version with the same code, i am not able to see the 4.0 dll in the Modules list...I used the same code as below, only project and the dll versions used are 4.0.

    I don't know, why it is not working. Please help me to resolve this issue.


    Code:
                Process currentProcess = Process.GetCurrentProcess();
    
                Process[] ObjModulesList = Process.GetProcessesByName(currentProcess.ProcessName);
    
                // Populate the module collection.
                ProcessModuleCollection ObjModules = ObjModulesList[0].Modules;

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