.NET Core 应用程序不支持 CodeDOM 格式的反序列化。 [XAF Winforms]

问题描述 投票:0回答:1

我最近用 24.1.3 升级了我的 .Net Framework XAF Winforms 应用程序.Net8

如下

   public static void DoPrintReport(DevExpress.ExpressApp.View view, IReportDataV2 reportData, ReportsModuleV2 reportsModule)
   {
       //var report = ReportDataProvider.ReportsStorage.LoadReport(reportData);
       // IReportStorage reportStorage = ReportDataProvider.GetReportStorage(Application.ServiceProvider);
       // https://supportcenter.devexpress.com/ticket/details/bc4930/web-reporting-deserialization-from-the-codedom-format-has-been-disabled

       // changed to
       IReportStorage reportStorage = ReportDataProvider.GetReportStorage(null);
       var report = reportStorage.LoadReport(reportData); // gives error 

当运行时我得到

Deserialization from CodeDOM format is not supported in .NET Core applications.

   at DevExpress.XtraReports.UI.XtraReport.LoadLayoutInternal(Stream stream, XtraReport& compiled report, Boolean forceDataSource, AccessSettings accessSettings, Boolean ignoreFileExtensionValidation, Func`1 trustPrompt)
   at DevExpress.XtraReports.UI.XtraReport.LoadLayoutInternal(Stream stream, Boolean ignoreFileExtensionValidation, Func`1 trustPrompt)
   at DevExpress.XtraReports.UI.XtraReport.LoadLayout(Stream stream)
   at DevExpress.ExpressApp.ReportsV2.ReportStorageBase.LoadReportCore(IReportDataV2 reportData, XtraReport report)
   at DevExpress.ExpressApp.ReportsV2.ReportStorageBase.LoadReport(IReportDataV2 reportData)
   at SBD24.JT.Win.Functions.WinHandyReportFunctions.DoPrintReport(View view, IReportDataV2 reportData, ReportsModuleV2 reportsModule) in C:\Users\kirst\source\repos\SBD24.JT\SBD24.JT.Win\Functions\WinHandyReportFunctions.cs:line 20

报告存储在ReportDataV2表中

此帮助我知道我需要将报告记录的内容字段转换为XML格式。

我想知道怎么做。或者是否有某种标志可以使其工作,因为我在 Winforms 中运行。

更新

研究编写框架应用程序来进行转换。 事实证明这很困难,因为最新的 xaf 向导不支持带有 .Net Framework 的实体框架

更新

我尝试重新安装 XAF 20.2.3,但 VS2022 不是受支持的 IDE

c# winforms .net-8.0 codedom xaf
1个回答
0
投票

试试这个,我使用的是 v.22。*

try
 {
     xtraOpenFileDialog1.Filter = "repx files (*.repx)|*.repx";

     var dr = xtraOpenFileDialog1.ShowDialog();

     if (dr == DialogResult.OK)
     {
         XtraReport report = new XtraReport();
         report.LoadLayout(xtraOpenFileDialog1.FileName);
         report.SaveLayoutToXml(xtraOpenFileDialog1.FileName);

         MessageBox.Show($"File '{xtraOpenFileDialog1.SafeFileName}' coverted to XML format");
     }
 }
 catch (Exception ex)
 {
     MessageBox.Show($"File '{xtraOpenFileDialog1.SafeFileName}' failed to covert to XML format");
 }
© www.soinside.com 2019 - 2024. All rights reserved.