0

I work on WinApp in Visual Studio 2010 (With C# Language)

I want to add one dll (not system dll) to Reference.

but when I open Add Reference Window And Browse dll see under error message:

Could not load file or assembly 'W2D_D2.dll' or one of its dependencies. The module was expected to contain an assembly manifest.

this file may not be a managed assembly.

I even change the Target Platform from ".net framework 4 client profile" to ".net framework 4" but not difference.

How Can Add This dll To My Project?

Community
  • 1
  • 1
mehdi
  • 59
  • 4
  • 10

1 Answers1

0

Looks like this DLL is not a managed assembly. You can check this very quickly by trying to open it with ILSpy or Reflector.

If this is the case, you'll have to pinvoke or use com to use this dll.

Steve B
  • 36,818
  • 21
  • 101
  • 174
  • Thanks Steve .i download ILSpy and run it but this program cant open my dll. but i could add this dll to my project in past. but now i cant. please explain pinvoke and com to use my dll. thanks – mehdi Jun 20 '12 at 15:24
  • Pinvoke mean calling native code from managed code. Com component are a way to create reusable component. You will have to choose the correct method to use your DLL, but it depends on your DLL. Check the documentation of the provider of the DLL to understand of it works and to choose the correct bridge. In all case, you will have to google a lot to make it working. – Steve B Jun 20 '12 at 15:46
  • A small obvious test that can avoid you a lot of headache... is the dll file corrupted ? did you try to replace the dll by one from a place where it works ? – Steve B Jun 20 '12 at 15:47
  • thanks... i can solve my problem with little chanse. i search w2d_d2w.dll to all partions in my computer and find a dll ( "interopt.w2d_d2w.dll" (with 6 kb)) that exist in my project (obj folder). and this dll work on my project very well. but my w2d_d2w.dll is 80kb. but this new dll work well. I 'm a little confused. – mehdi Jun 20 '12 at 16:00
  • lucky:) bridging managed and unmanaged code can cause serious troubles to mental sanity. – Steve B Jun 20 '12 at 16:03