有没有一种方法可以按照正确的顺序自动编译文件。"CompileAssemblyFromFile"似乎不关心依赖项在编译之前。怎么了?
public bClass
{
public aClass FieldName; //Trows error not aClass type not found
}
编译订单
1. bClass.css
2. aClass.cs
它对我的工作顺序有两种:
var pro = new CSharpCodeProvider();
var assem = pro.CompileAssemblyFromFile(new CompilerParameters(), "path/to/bClass.cs", "path/to/aClass.cs");
// or
var assem = pro.CompileAssemblyFromFile(new CompilerParameters(), "path/to/aClass.cs", "path/to/bClass.cs");
aClass.cs:
public class aClass
{
}
bClass.cs:
public class bClass
{
public aClass FieldName;
}