Visual C# Developer Center > Visual C# Forums > Visual C# Language > Cannot use DLL library in my code
Ask a questionAsk a question
 

AnswerCannot use DLL library in my code

  • Tuesday, October 27, 2009 2:35 PMxslaugh Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi,

    I just downloaded the C5 collections library to use in one of my projects.  I downloaded the DLL version of the library, and have add a reference to it to my project.  However, whenever I try to use the DLL, I get this error:

    System.Security.SecurityException: That assembly does not allow partially trusted callers.

    I haven't been able to get rid of this error.  As far as I know, all of my code should be running in full trust mode.  Does anyone have any ideas?

    Thanks!

Answers

  • Wednesday, November 04, 2009 4:13 PMxslaugh Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    I tried a few things and wasn't able to get the dll working.  I finally ended up just downloading the source and compiling the dll myself, after which it worked fine.
    • Marked As Answer byxslaugh Wednesday, November 04, 2009 4:13 PM
    •  

All Replies

  • Tuesday, October 27, 2009 2:51 PMGanesh Ranganathan - Bangalore, India Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Are you running the application on a network or from the local system?
    Ganesh Ranganathan
    [Please mark the post as answer if it answers your question]
    blog.ganeshzone.net
  • Tuesday, October 27, 2009 3:02 PMxslaugh Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Everything is running locally.
  • Tuesday, October 27, 2009 5:09 PMRudedog2ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Check the documentation associated with the library.

    It seems that you might need to add some security attributes to your code.

    Mark the best replies as answers. "Fooling computers since 1971."
  • Tuesday, October 27, 2009 5:24 PMBalaji Baskar Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Try registering your DLL. Use the following command (RegSvr32) in command prompt.

    Usage: regsvr32 [/u][/s][/n][/i[:cmdline]] dllname
    /u - Unregister server
    /s - Silent; display no message boxes
    /i - Call DllInstall passing it an optional [cmdline]; when used with /u calls dll uninstall
    /n - do not call DllRegisterServer; this option must be used with /i



     Balaji Baskar
    [Please mark the post as answer if it answers your question]
  • Tuesday, November 03, 2009 3:50 PMRudedog2ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    xslaugh,

    Are you still having problems?

    Mark the best replies as answers. "Fooling computers since 1971."
  • Wednesday, November 04, 2009 4:13 PMxslaugh Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    I tried a few things and wasn't able to get the dll working.  I finally ended up just downloading the source and compiling the dll myself, after which it worked fine.
    • Marked As Answer byxslaugh Wednesday, November 04, 2009 4:13 PM
    •