到目前为止,我已经在我的.net项目中使用了stimulsoft
没有问题,但是当我尝试将项目迁移到.net核心时,事情并没有奏效。这是我使用stimulsoft库的过程:
report = new StiReport();
report.Load("test.mrt");
report.Compile(); //--> here I get System.Windows.Forms load exception
MemoryStream memoryStream = new MemoryStream();
report.ExportDocument(StiExportFormat.Html, memoryStream); //--> here I get User32.dll load exception
首先,我在编译阶段遇到以下错误:
FileNotFoundException: Could not load file or assembly 'System.Windows.Forms, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
然后我评论编译行,但我在导出阶段出现以下错误:
DllNotFoundException: Unable to load DLL 'User32.dll': The specified module or one of its dependencies could not be found.
我从nuget安装了Stimulsoft.Reports.Web.NetCore
版2018.2.3
。虽然此软件包的目标是.net核心,但仍依赖于平台相关模块。难道我做错了什么?有人可以帮忙吗?
PS:我在ubuntu 16.04
上运行应用程序
Stimulsoft.Reports.Web.NetCore
尚不支持.NET Core上的StiReport.Compile()
(自版本2018.2.3起)。
此方法对于报表中的C#代码是必需的(<Script>
元素)。因此,如果您的报告依赖于内部的C#代码,您应该切换回.NET Framework和Stimulsoft.Reports.Net
。
或者只是删除带有Compile()
调用的行,否则导出将在Windows上顺利运行(但报告中的C#代码没有进行任何动态修改)。
不幸的是,我没有在Linux下运行Stimulsoft报告的经验,所以不能告诉你对User32.dll
的依赖。但你可以问支持者,他们反应灵敏。