Visual Studio 2010 doesn't find the [DllImport("")]
I'm trying to use an C++ library in my c# application but my Visual Studio 2010 doesn't know the [DllImport("")]-method at all. He always ask me to generate the Methodstub for DllImport.
I already added the "using System.Runtime.InteropServices;" but it doesn't work.
Thanks for your helpt!开发者_如何学编程
It sounds like you're using the DLLImport in the wrong spot in your code. You didn't post your code, but make sure its not in a method. Try putting it in your class:
public class MyClass
{
[DllImport("")]
//method
public Class()
{
}
// Other methods
}
精彩评论