你有没有正确添加呢?new aaa.createAAA()是不是自动生成的,如果不是,应该没有正确添加,
我的添加方式是这样的,在要调用dll的程序里,选中右边的添加引用,再选浏览,找到dll文件的的所在,添加就行了

解决方案 »

  1.   

    也有可能是你的dll里的方法都是private的,不能调用
      

  2.   

    你需要使用 DllImportAttribute 标识 DLL 和函数。用 static 和 extern 修饰符标
    记方法。你可以看看.NET联机帮助里“在托管代码中创建原型”的说明。下面是它的例子:
    using System.Runtime.InteropServices;public class Win32 {
         [DllImport("user32.dll", CharSet=CharSet.Auto)]
         public static extern int MessageBox(int hWnd, String text, 
                         String caption, uint type);
    }public class HelloWorld {
        public static void Main() {
           Win32.MessageBox(0, "Hello World", "Platform Invoke Sample", 0);
        }
    }
      

  3.   

    上面给出的是调用非托管dll的方法,如果是C#的托管函数,你只要在项目中添加dll引用,再实例化
    就可以了。
      

  4.   

    mt_wang 我按找你做了出现了:
    Could not load type vzoom.pass9WebInterface from assembly vzoom_dotnet, Version=1.0.1763.26590, Culture=neutral, PublicKeyToken=null because the method LoadPubKey has no RVA. 
    错误这个是什么原因啊