开发者

Visual Studio 2010 doesn't find the [DllImport("")]

开发者 https://www.devze.com 2023-04-01 14:36 出处:网络
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'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
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号