我用C#创建了一个DLL,并try 从它调用一个函数.但它有一个错误:
未处理的异常:System.IO.FileNotFoundException:无法加载文件或程序集‘System.Runtime,版本=6.0.0.0,区域性=中性,PublicKeyToken=b03f5f7f11d50a3a’或其依赖项之一.系统找不到指定的文件.
我的DLL代码:
using System;
namespace Draf_Lib
{
public class Class1
{
public static int add(int x, int y) { return x + y; }
}
}
下面是我从其中调用该函数的C#代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
//using MacroLib;
using Draf_Lib;
namespace Draft1
{
internal class Program
{
static void Main(string[] args)
{
System.Console.WriteLine("Hello");
Class1 c = new Class1();
int b = Class1.add(9, 8);
Console.WriteLine(b);
}
}
}
我已经把图书馆作为参考了.有没有人能给我个建议来解决这个问题?