目录
项目BBB生成dll后,你对BBB进行修改,dll也会随之改变,
首先,把两个项目放在同一个解决方案中
例如:启动项目AAA,待引用项目BBB
启动项目AAA代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BBB;
namespace AAA
{
class Program
{
static void Main(string[] args)
{
function f = new function(1,2);
f.printf();
}
}
}
待引用项目BBB代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BBB
{
public class function
{
public int a, b;
public function(int a,int b)
{
this.a = a;
this.b = b;
}
public void printf()
{
Console.Write(a + b);
Console.ReadKey();
}
}
class Program
{
static void Main(string[] args)
{
}
}
}
然后,生成项目BBB的dll
右击项目BBB,在出现菜单中,点击生成
其次,项目AAA添加引用
在项目AAA中添加引用,即BBB生成的dll
添加引用结果: