2

I am attempting to use the MediaInfo.dll within an MVC4 project designed in c# but I am having difficulty in getting this working. I found the following page: http://teejeetech.blogspot.co.uk/2013/01/mediainfo-wrapper-for-net-projects.html and having followed the instructions I have hit a wall.

I have added the MediaInfoNet.dll to my project and have downloaded the MediaInfo.dll in both 32 and 64 bit versions without installers and placed them in my system32 and sysWOW54 folders. I have then added the following code:

MediaFile uploadedFile = new MediaFile("C:\\Users\\jpmcfeely\\Desktop\\Videos\\Quarry.mp4");
string duration = uploadedFile.General.DurationString.ToString();

When debugging through this I get the following error on MediaFile uploadedFile:

An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

Any ideas what could be causing my issue?

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
Jay
  • 3,012
  • 14
  • 48
  • 99
  • Does that help: http://stackoverflow.com/questions/2023766/an-attempt-was-made-to-load-a-program-with-an-incorrect-format-even-when-the-p? – meilke Sep 15 '13 at 09:37
  • That means it was trying to load a 64 bit dll in a 32 bit environment or vice versa. Check your project properties build tab, and make sure you have the right dll in the right folder – Tony Hopkinson Sep 15 '13 at 09:38
  • @meike I have checked and my application pool already had allow 32 bit set to true – Jay Sep 15 '13 at 12:38
  • @TonyHopkinson I have checked the project properties build tab and was set to any cpu if i change to x64 same thing and if i change to x86 it wont run at all as it is an azure project, not sure how to check the right dll in the right folder in this screen no information of this sort showing – Jay Sep 15 '13 at 12:45
  • 1
    We if it won't run in 32 bit all, take the 32 bit version of the dll out and build as 64 bit. This might help you to see what's what. http://stackoverflow.com/questions/495244/how-can-i-test-a-windows-dll-to-determine-if-it-is-32bit-or-64bit – Tony Hopkinson Sep 15 '13 at 13:24

1 Answers1

1

Upgrade the DLL in your application bin folder to the 64 bit version of the dll available from http://mediaarea.net/en/MediaInfo/Download/Windows and choose the 64 bit without installer. This can be used with the MediaInfoNet dll and it correctly returns the duration string

Jay
  • 3,012
  • 14
  • 48
  • 99