locked
How do I include a dll in my project RRS feed

  • Question

  • Hi everybody,


    I´m trying to use a dll in my Project using:

    [DllImport("shapelib.dll", CharSet=CharSet.Auto)]

    I add the dll file doing: right botton of the mouse over my project - > Add existing item -> And I select the dll file.

    The project compiles ok but when it  uses the dll I get the following unhandled exception:

    System.MissingMethodException was unhandled
      Message="Can't find PInvoke DLL 'shapelib.dll'."


    How can I use a dll file in my Pocket Pc Application ?

    Thank you,



    Wednesday, August 23, 2006 6:07 PM

Answers

  • Have you checked using file explorer on device if file indeed exists? If it does, it might be what you using DLL not designed for your device.

    If you don't know, you should ask whoever you got this DLL from. Rule of thumb is: if you can use this DLL on desktop, you won't be able to use it on device. Also see this:

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=641146&SiteID=1

    Wednesday, August 23, 2006 10:28 PM

All replies

  • Add DLL (or any other file for that matter) to the project, set build action to "content" and change deployment condition as needed. It's all in the file's properties.

    Wednesday, August 23, 2006 6:42 PM
  • I have added the dll to the project, but I don´t know how do I se the build action to "content".

    Can you give me a more detailed explication?

    What is the deployment condition?

    Thank you for your response.

    Wednesday, August 23, 2006 9:02 PM
  • 1. Pick your DLL file in the solution explorer.

    2. Right click on it and choose "Properties" from the menu.

    3. On the property page among available properties you would see "Build action" property which you should set to "Content" from drop down menu. You would also see "Copy to output directory" properly which you should set to "Copy always".

    Wednesday, August 23, 2006 9:37 PM
  • Thank you, i have done exactly what you say but it happens the same error.

    Any other sugestion?

    How can I know if the dll file works with Compact Framework?


    Wednesday, August 23, 2006 9:57 PM
  • Have you checked using file explorer on device if file indeed exists? If it does, it might be what you using DLL not designed for your device.

    If you don't know, you should ask whoever you got this DLL from. Rule of thumb is: if you can use this DLL on desktop, you won't be able to use it on device. Also see this:

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=641146&SiteID=1

    Wednesday, August 23, 2006 10:28 PM
  • Make sure the folder Name no Space .

    确保文件夹名称无空格即可。

    Friday, February 29, 2008 2:39 AM
  • Add DLL (or any other file for that matter) to the project, set build action to "content" and change deployment condition as needed. It's all in the file's properties.

    I added a dll in my resources and use it like below but I think I should check it as a reference like I did before on the another project. Hope you can notice my post and responce.

    Sunday, December 8, 2013 2:40 PM