I am developing a c# application that extract a cab file from a setup package.
to do that I am using LoadLibrary. this is the pinvoke C# signature.
[DllImport("kernel32", SetLastError = true, CharSet = CharSet.Ansi)]
internal static extern IntPtr LoadLibrary([MarshalAs(UnmanagedType.LPStr)]string lpFileName);
The above code works fine when compiling the project to x86, but if I compile it to anycpu it fails, and the last win32 error is:
"%1 is not a valid Win32 application"
I tried to use IntPtr insted of a string, and also to use dfferent charset but nothing worked.