Create a Combined .NET WinForms and Blazor Solution
- 2 minutes to read
In Visual Studio, create a new project. Select the DevExpress v25.1 Template Kit project template and click Next. Specify the new solution’s name and location. Then, click Create.
In the invoked Template Kit window, select XAF.
The XAF window contains a list of XAF application settings. Select Web (ASP.NET Core Blazor) and Desktop (Windows Forms) options in the Platforms section.
Customize other application settings according to your requirements and click Create Project.
Target Multiple .NET Platforms in a Single XAF Shared Module Project
Use Cross-platform targeting to reference a module in multiple applications or libraries for different target frameworks. This technique helps you avoid two .CSPROJ files for different Target Frameworks. A single .CSPROJ file defines the TargetFrameworks element and required dependencies for each target condition: <TargetFrameworks>net8.0;net48</TargetFrameworks>
We recommend this multi-targeting solution for both typical situations, where your shared XAF Module or Class Library project (SolutionName.Module) currently targets .NET Framework (<TargetFramework>net48;/TargetFramework>
) or .NET Standard 2.0 (<TargetFramework>netstandard2.0;/TargetFramework>
).
Example
If you used .NET Standard 2.0 to share code between .NET Framework and all other .NET implementations, here is a simple change that you will need to make to your cross-platform library (.CSPROJ) that supported .NET Standard in v23.1 (or earlier versions), when you upgrade its DevExpress dependencies to v23.2+.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- BEFORE (v23.1 and older)-->
<!-- <TargetFramework>netstandard2.0;/TargetFramework> -->
<!-- AFTER (v23.2 and newer) -->
<!-- Your shared Class Library will output net8.0 and net48 assemblies -->
<TargetFrameworks>net8.0;net48</TargetFrameworks>
</PropertyGroup>
</Project>
Also attached are complete sample projects for your reference. For more information, review this Breaking Change notice.