新建一個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;
}
}
}
用下圖命令構(gòu)建為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();
}
}
目前都是在同一目錄;構(gòu)建testdll.cs;出錯;?
?
看一下指定需要的dll是不是 /addmodule ,錯了,
?
用 /r 指定需要的dll,然后構(gòu)建;構(gòu)建成功,運(yùn)行如下;
?文章來源:http://www.zghlxwxcb.cn/news/detail-514710.html
?文章來源地址http://www.zghlxwxcb.cn/news/detail-514710.html
到了這里,關(guān)于C# csc構(gòu)建dll 和 csc構(gòu)建時指定dll的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!