If the dll is a system dll, you should add it like this programmatically:
[DllImport("gdi32.dll", CharSet = CharSet.Ansi, BestFitMapping = true, ThrowOnUnmappableChar = true)]
And make sure that the project ( Platform Solution ) is set to 32 or x86 , and not any CPU. You can find more about this with a simple Google search . Happy coding
source share