C# getting version of unmanaged dll

c#, unmanagedresources

Solution

As stated by logicnp; the Assembly.Load is for managed assemblies only. To determine the version of any version-ed file you can use System.Diagnostics.FileVersionInfo.GetVersionInfo(filename) and to load and call unmanaged procedures in DLLs you can refer to these articles:

http://blogs.msdn.com/jonathanswift/archive/2006/10/02/780637.aspx http://blogs.msdn.com/jonathanswift/archive/2006/10/03/Dynamically-calling-an-unmanaged-dll-from-.NET-_2800_C_23002900_.aspx

Good luck...

Problem

I'm calling an unmanaged dll from my managed c# code and wanted to check I'm calling the right version. The code I'm trying to load the assembly (to then get the resource file and then get the version) is: cur_version = Assembly.LoadFile("X:\Workspace\yreceipts_pos\yRprintProcessor\Debug\yRprintProcessor.dll"); It's failing because of this error: `The module was expected to contain an assembly manifest. (Exception from HRESULT: 0x80131018)` Does anyone know how to get around this or have a better way to check the version of an unmanaged dll from managed c# code? Thanks in advance, Richard

Original source

Related problems