有两个源文件Test1.cs和Test2.cs
Test1.cs:
public class Test1
{
public string strTest = "Hello!";
}Test2.cs:
using System;class Test2
{
static void Main()
{
Test1 objTest = new Test1();
Console.WriteLine("{0}", objTest.strTest);
}
}编译语句:
csc /out:Test.dll /t:library Test1.cs
csc /out:Test.exe /r:Test.dll Test2.cs编译通过了,但是运行时报错,不知道为什么 大家过来帮忙看一下啊
错误提示:未能从程序集Test.dll中加载类型Test1
Test1.cs:
public class Test1
{
public string strTest = "Hello!";
}Test2.cs:
using System;class Test2
{
static void Main()
{
Test1 objTest = new Test1();
Console.WriteLine("{0}", objTest.strTest);
}
}编译语句:
csc /out:Test.dll /t:library Test1.cs
csc /out:Test.exe /r:Test.dll Test2.cs编译通过了,但是运行时报错,不知道为什么 大家过来帮忙看一下啊
错误提示:未能从程序集Test.dll中加载类型Test1
csc *.cs
第一个文件生成:Test1.dll
第二个文件生成:Test2.exe
执行编译语句:
csc/r Test1.dll Test2.exe
注意:两个文件必须在同一个盘符下!
方法2:csc /out:Test1.dll /t:library Test1.cs
csc /out:Test.exe /r:Test1.dll Test2.cs
Test2编译成exe并且引用Test1编译过来的dll啊
但是好像不行嘛~~