我加载了一个程序集
private System.Reflection.Assembly;
object myData;
myAssembly = System.Reflection.Assembly.LoadFile("C:\\CrystalDecisions.CrystalReports.Engine.dll");
然后我创建一个实例。
myData=myAssembly.CreateInstance("CrystalDecisions.CrystalReports.Engine.ReportDocument", true);
这个myData总是返回null,为什么它返回null,因为myAssembly有汇编信息及其公钥令牌?
答案 0 :(得分:0)
尝试类似下面的内容。
// dynamically load assembly from file Test.dll
Assembly myData = Assembly.LoadFile(@"C:\CrystalDecisions.CrystalReports.Engine.dll");
// get type of class Calculator from just loaded assembly
Type myData = myData.GetType("CrystalDecisions.CrystalReports")
// create instance of class Calculator
object myDataInstance = Activator.CreateInstance(myData);