Reporting - Visual Studio Integrated Report Designer for .NET Apps (CTP, v21.1)

Reporting Team Blog
26 May 2021

We’ve got some great news for those awaiting our .NET 5-compatible Visual Studio Report Designer. With our v21.1 release, you’ll be able to design reports for .NET apps within Visual Studio. We want to thank our loyal users for the great feedback - We certainly hope that this market-first solution meets your approval and exceeds your expectations.

Prerequisites

A Brief Intro

With our v21.1 release, you'll have access to our Visual Studio .NET Core Report Designer extension (*.vsix) in desktop WinForms and WPF apps that target .NET Core 3.1 and above. Those who have used DevExpress Reports within ASP.NET Core projects will be familiar with this extension as it was first introduced in v18.1: Reporting - .NET Core Support (CTP, v18.1). For newcomers and desktop application developers: this extension allows you to create and edit reports in Visual Studio projects that target .NET Core. Reports are stored in the project as *.vsrepx files. Refer to the following help topic for more information in this regard: Create a Report in Visual Studio.

During our last development cycle, we engineered the necessary backend process for this extension. As a result, it evolved into a client-server tool that works much like the .NET Core Windows Forms Designer created by Microsoft.

As you may already know, the Visual Studio application devenv.exe is built atop the .NET Framework. On the component side, it’s almost impossible to correctly interact with its assemblies (because they may be built against multiple versions of .NET). Our implementation allowed us to bypass technical limitations related to the instantiation of custom types from custom assemblies.

How to Enable the New Report Designer for .NET Apps

By default, the Visual Studio .NET Core Report Designer extension comes into play when you add a new report to your application. To enable the new designer, do the following:

1) Double click the newly added *.vsrepx file in Visual Studio to open it.

2) Locate the XtraReports Menu in the Visual Studio bar and open the Designer Options window:

3) In this window, enable the Use the preview Report Designer (CTP) for .NET /.NET Core apps setting in the Design category:

4) Restart Visual Studio and reopen report designer.

That’s it, you’re all set. This new Report Designer is now fully functional: you can bind reports to data, use report wizards and data sources, drag and drop report controls/fields onto the report design surface, and execute report-related operations.

Note: Though the “parent” report file is now *.vsrepx, you can still use report class instances to open the file in Print Preview or within the End-User Report Designer (for both WinForms and WPF apps). In web apps such as Blazor or ASP.NET Core, you must use Report Name Resolution Services and reference a report by its unique name.

How to Migrate and Edit Your Reports in the New Report Designer

You say - “Okay, that’s fine, but what’s going to happen with reports that already exist in my app?“. One of the answers to this question is somewhat simple: DevExpress products have supported .NET 5 since v20.1.6 - released in July, 2020. All reports you migrated in the past should function as expected within apps that have already been migrated to .NET 5 SDK.

The story of course is more complicated if you must modify legacy reports. First, an important note:

We have more to come this summer as it relates to our integrated Visual Studio Report Designer. I recommend that you only follow the migration path below and only for reports that require your immediate attention and modification. Please leave the other reports untouched and keep them as class (.CS / .VB) files within your project.

If you need to edit/modify legacy reports, with the ultimate goal of migrating them to an XML-like report layout with a *.vsrepx file extension (and replace existing report source code files), please follow these instructions:

If you have access to the .NET Framework version of your app:

Open the report designer, invoke a report’s smart tag and select "Save…". Review the following help topic for more information in this regard: Saving Reports using Application GUI. Make certain to save the XML (not the CodeDom one) file.

If you’ve already migrated your app to .NET 5:

Modify your application code to instantiate the required report instance at runtime and use the XtraReport.SaveLayoutToXml method to store the XML file. Run the application in debug mode to generate the file.

Now, (very important) backup all report-related files (usually, these are *.cs, *.Designer.cs, *.resx) and unload them from your .NET 5 project. Then, add a new blank report to your project: Add a New Report. This action will generate the *.vsrepx, *.Designer.cs and *.cs files:

Finally, open a report's smart tag, select "Open/Import..." and choose the XML file we stored previously to apply the layout to this newly created report: Loading Reports using Application GUI. Once you complete these steps, you can compile your application without errors and display a preview of the report at runtime. Don’t forget to test your report for errors!

Important: Please remember that storing a report layout as XML does not serialize event handlers and associated code. A fly in the ointment is that you need to move such code to the newly generated *.cs file manually: you can either do this by writing code or by double-clicking events in the properties panel. This is where the backup report file will come in handy.

Conclusion

Why our Visual Studio Report Designer will be issued as a Community Tech Preview (CTP)? The reason it will be released as a CTP is rather simple: We still need to deliver a more seamless user experience for those with legacy reports – a better way to work with class files (*.CS / *.VB). Stay tuned to this blog for further updates in this regard. In the meantime, please do let us know what you think below.

FREE DevExpress Xamarin UI Controls

Deliver high-impact native mobile apps with our feature-rich Data Grid, Scheduler, Chart, TabView, Editors, and utility controls. Reserve your free copy today!
dbSoft
dbSoft

Hello DevExpress team. Can i migrate my winform net framework project  to Net 5? 

26 May 2021
Dmitry (DevExpress)
Dmitry (DevExpress)
@dbSoft The short answer is "yes", the long answer is "depends on whether you need design-time features"
If your application is mostly ready and all you will require to edit is some code-behind, then yes, you can absolutely migrate to .NET 5. You will need to resolve possible breaking changes introduced in the latest .NET 5 versions (for example, this change that affects comparing strings), but our controls are fully functional.

Otherwise, if your app is still under active development (including form and user control designer), please bear in mind that design time is still not fully supported. Many crucial features like assigning a data source to a data-aware control are currently not available even for standard Microsoft controls. You can still migrate from .NET Framework to .NET, but you will need to follow the workaround suggested by Microsoft: have two .csproj files in your solution and switch to the old .NET Framework one when you need Visual Studio designer. See this KB article for more details: Design-Time Support for DevExpress WinForms Controls for .NET 5 - FAQ.
27 May 2021
Tobias Johansson
Tobias Johansson
Nice! Thanks!
27 May 2021

Please login or register to post comments.