简体   繁体   English

程序集createinstance和Crystal报告问题

[英]Issue with assembly createinstance and crystal report

I load an assembly 我加载一个程序集

private System.Reflection.Assembly;
object myData;

myAssembly = System.Reflection.Assembly.LoadFile("C:\\CrystalDecisions.CrystalReports.Engine.dll");

then i create an instance. 然后我创建一个实例。

myData=myAssembly.CreateInstance("CrystalDecisions.CrystalReports.Engine.ReportDocument", true);

this myData always returns null, any thought why it is returning null where as myAssembly has the assembly information and its public key token? 此myData始终返回null,是否想到为什么在myAssembly具有程序集信息及其公钥令牌的地方返回null?

try something like the following below.. 请尝试以下类似的方法。

// 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);

Reflection Examples C# 反射示例C#

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM