用VS2005的自带的工具VS2005命令提示符来编译引用更简单一些,用命令/r:即可调用DLL文件。(如:client.exe /r:E:\areverser.dll E:\client.cs)
添加命名空间:
using System.RunTime.Interopservices;
[DllImport("你的DLL名称.dll")]
public static extern void test ();
test () 是你dll中的一个方法
添加命名空间:
using System.RunTime.Interopservices;
....
[DllImport("Dll")]
首先在要引用dll的类里(右边的解决方案管理器里)类的引用-右键-添加引用-.net-System.Configuration,然后在这个类里using System.Configuration,这个类就可以用了
你的引用有问题!在开始加上using System.RunTime.Interopservices才能使用Dllimport。