wpf “CrystalDecisions.Shared.ExportOptions”的类型初始值设定项引发异常
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19650337/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
The type initializer for 'CrystalDecisions.Shared.ExportOptions' threw an exception
提问by G K
I am using SAP crystal reports in my wpf application, I am getting this exception at the time of initialization
我在 wpf 应用程序中使用 SAP 水晶报告,我在初始化时收到此异常
ExportOptions _ExportOptions = new ExportOptions();
this is the error I am getting "The type initializer for 'CrystalDecisions.Shared.ExportOptions' threw an exception."
这是我收到的错误“'CrystalDecisions.Shared.ExportOptions' 的类型初始值设定项引发异常。”
and this is inner exception says
这是内部异常说
{"Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.":"log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"}
{"无法加载文件或程序集 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' 或其依赖项之一。系统找不到指定的文件。":"log4net, Version=1.2.10.0,文化=中性,PublicKeyToken=692fbea5521e1304"}
total inner exception including message is in this link
包括消息在内的全部内部异常在此链接中
I tried to add the dll reference of the particular version, even though it is still showing the same issue. I am very worrying about this issue as I could not figure out the solution for a long time.
我尝试添加特定版本的 dll 引用,即使它仍然显示相同的问题。我很担心这个问题,因为我很长一段时间都想不出解决方案。
any help highly appreciated.
任何帮助高度赞赏。
Thanks Ganesh
谢谢 Ganesh
回答by campagnolo_1
My suspicion is that you don't have the runtime for CR installed correctly. A lot of people make the mistake and install the runtime using the msi installer instead of the exe. The msi does not integrate CR with VS, the exe does. As Raphael pointed out in his comment, this posthas a very good thread and explanation by Ludek, who is one of the sharpest minds at SAP. You can download the exe here.
我怀疑您没有正确安装 CR 的运行时。很多人都犯了错误,并使用 msi 安装程序而不是 exe 来安装运行时。msi 不会将 CR 与 VS 集成,而 exe 会。正如 Raphael 在他的评论中指出的那样,这篇文章有一个非常好的线索和 Ludek 的解释,他是 SAP 最敏锐的头脑之一。您可以在此处下载 exe 。
Hope that helps,
希望有所帮助,
Chris
克里斯
回答by J R B
I had also faced same issue , i had change my projects Target framework to .NET Framwork 4. you can change the same from project property->Application tab ->Target framework.
我也遇到过同样的问题,我已经将我的项目目标框架更改为.NET 框架 4。您可以从项目属性->应用程序选项卡->目标框架中更改相同的内容。

