新建一个mydll.cs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace myDLL
{public class MyMath{public int add(int x, int y){return x + y;}public int sub(int x, int y){return x - y;}}
}
用下图命令构建为dll;看下dll有了;
新建一个testdll.cs;
using System;
using myDLL;class Program
{static void Main(string[] args)
{MyMath a = new MyMath();int c = a.add(99, 77);Console.WriteLine("99+77=" + c);Console.ReadKey();
}}
目前都是在同一目录;构建testdll.cs;出错;
看一下指定需要的dll是不是 /addmodule ,错了,
用 /r 指定需要的dll,然后构建;构建成功,运行如下;