2

I am trying to access a file from network drive through C# using @boskop 's solution found here.

There's a part where we will have to import this windows dll

[DllImport("mrp.dll")]

And here's the error I get:

Unable to load DLL 'mrp.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

Any ideas on the cause of the error and its solution?

The solution is found... It was a type as Hans pointed and the .dll had to be put along side the assembly as rbm pointed ... I would like to leave the question unedited... it might help some other afflicted programmer like me.. :D

6
  • Is the mrp.dll located alongside your assembly or in the %PATH% ? Commented Sep 11, 2015 at 10:34
  • Good question... Thanks ... It is not found alongside assembly but in this location - C:\Windows\WinSxS\x86_microsoft-windows-mpr_31bf3856ad364e35_6.3.9600.16384_none_42758df9738ae6df .... But if copy and paste it in the assembly folder, will it create any problem? it seems to be a windows core dll.. I am a little worried to duplicate it... What do you suggest? @rbm Commented Sep 11, 2015 at 10:40
  • 1
    Slight case of dyslexia at work here, it is "mpr.dll", not "mrp.dll". You got it half-right in the question title. If you are prone to reversing letters, not an uncommon programmer affliction btw, then always put that at the top of the "why isn't it working" list of things to check. Commented Sep 11, 2015 at 10:48
  • Woah... That was exactly what I had done ... Thanks much.. Now it works fine... :) Not an uncommon programmer affliction You nailed it! :D @HansPassant ... I had also put it along side the Assembly as rbm suggested .. Commented Sep 11, 2015 at 11:03
  • AFAIK, you shouldn't need to copy it to the directory if it's in %PATH%. Check msdn.microsoft.com/en-us/library/ms682586(VS.85).aspx Commented Sep 11, 2015 at 11:32

1 Answer 1

0

Well you can copy the desired dll (mpr.dll) to your local assembly folder, then follow steps as shown in below image.

  1. In your solution explorer, right click at References, and pick Add Reference.
  2. It will open another window, from here, you can browse your DLL. Give the location and Add.
  3. Now write [DllImport("mpr.dll")]

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.