Search code examples
c#wpf.net-corereportstimulsoft

Operation is not supported on this platform for Stimulsoft report in .NET Core 6


I'm using C# WPF in .NET Core 6 and Visual Studio 2022.

I have added StiReport.dll to my project, but I got error for this code :

public MainWindow()
{
    InitializeComponent();

    var report = new StiReport();
    var pathreport = @"C:\Users\Administrator\source\repos\Gozaresh\Gozaresh\BUGETRP.mrt";

    report.Compile(); //→ Error : System.PlatformNotSupportedException: 'Operation is not supported on this platform.'
    report.Render();
    report.Show();
}

System.PlatformNotSupportedException: Operation is not supported on this platform.

It works fine on .NET Framework 4.7.2 !


Solution

  • StiReport library is not supported in the .NET Core 6 platform. There are various reporting solutions available that support .NET Core, such as Telerik Reporting, Syncfusion Report Platform, or Stimulsoft Reports.Net Core,

    Try using Stimulsoft Reports.Net Core.Install the Stimulsoft Reports.Net Core NuGet package.

    Add the necessary using statements to import the Stimulsoft namespaces:

    using Stimulsoft.Report;
    using Stimulsoft.Report.Wpf;
    

    To create and display a Stimulsoft report. Here's an example:

    public MainWindow()
    {
        InitializeComponent();
    
        var report = new StiReport();
        var pathToReport = @"C:\Path\To\Your\Report.mrt"; // Replace with the actual path to your report file
        report.Load(pathToReport); // Load the report file
    
        var reportViewer = new StiWpfViewer();
        reportViewer.Report = report;
        reportViewer.Show();
    }