none
How to reference MPR.dll in Visual Studio project RRS feed

  • Question

  • Hi everyone, I have a mobile project in Visual Studio 2017.  I am using the open source class NetworkShareAccesser.cs to access a remote machine's folders.  The remote machine is my local PC.  I am running the mobile app I created on my iPhone not connected to a wireless network, using the Verizon cell phone network.  In the open source NetworkShareAccesser file, it uses teh directive [System.Runtime.InteropServices.DllImport("Mpr.dll")] and when I run the app, it says it cannot find MPR.dll.  When I try to add the MPR.dll reference to the Visual Studio project from the folder C:\Windows\system32, I get an error that says

    "A reference to C:\Windows\system32\mpr.dll could not be added.  Please make sure that the file is accessible, and that it as a valid assembly or COM component."

    So my question is how do I get mpr.dll added to the project so I can use the code in the NetworkShareAccesser class?


    Sunday, March 31, 2019 12:56 AM

All replies

  • The only thing you can add as references are other .NET assemblies, and mpr.dll is a standard Windows native DLL.

    You cannot access Windows DLLs in a Xamarin application.  Those DLLs are only available on Windows, and iPhones, of course, do not run Windows.

    Even bigger than that, you cannot access file shares over a cell phone network.  You might be able to access it using WiFi, assuming your WiFi hotspot is inside your firewall, but you'll have to use something that uses iPhone libraries to do it.


    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Sunday, March 31, 2019 7:18 AM
  • Thanks, Tim.  So my next question would be, is there any way at all to access files on my desktop computer at home over a cell phone network on my Xamarin app?  The app is up and running fine.  I am just trying to access folders on my local computer through my app, which is accessing the internet through 4G LTE cell network.  The desktop computer is mine, and I can do anything needed, such as port forwarding, etc
    Sunday, March 31, 2019 5:37 PM
  • Hi Joe Durda,

    If you want to know more about Xamarin, you could post a new thread in Xamarin forum.

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, April 1, 2019 6:09 AM