XPO - How to Share Class Libraries with the DevExpress Data or XPO Dependencies for Different Target Frameworks

XPO Team Blog
08 November 2019

UPDATED on March 13th 2020:

The former core DevExpress.Data and DevExpress.Xpo assemblies for .NET Core 3 (WinForms & WPF) and .NET Framework apps have been changed in v20.1. Their functionality now resides in the following assemblies:

  • DevExpress.Data and DevExpress.Xpo for .NET Standard;
  • DevExpress.Data and DevExpress.Xpo for .NET Framework;
  • DevExpress.Data.Desktop for .NET Core 3 (WinForms & WPF);
  • DevExpress.Data.Desktop for .NET Framework.

These changes are done for easier maintenance, clearer dependencies, and future code extension of .NET Core apps and the corresponding NuGet packages. This also helps greatly simplify common development tasks like sharing Class Libraries with the DevExpress.Data or DevExpress.Xpo dependencies for different Target Frameworks. For more information, see The DevExpress.Data, DevExpress.Xpo, and other cross-platform assemblies for .NET Core 3 (WinForms & WPF), .NET Standard, and.NET Framework apps have been split or removed.

---------------------------------------

Early .NET Core 3.0 adopters (those targeting WinForms and WPF) might recall that sharing common libraries with the DevExpress.Data or DevExpress.Xpo assemblies is more difficult for the "netcoreapp3.0" and "netstandard2.0" projects.

The good news is that we found a simpler solution - Cross-platform targeting or Multi-Targeting. This approach will help you avoid two CSPROJ files for different Target Frameworks - less code duplication and maintenance costs for your solution. To make it work, the CSPOJ file defines TargetFrameworks element and required dependencies for each target conditions. You can download a working sample from this Support Center ticket (T808990). 

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFrameworks>netstandard2.0;netcoreapp3.0</TargetFrameworks>
    <Description>Sample project that targets multiple TFMs</Description>
  </PropertyGroup>
  <ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
    <PackageReference Include="DevExpress.Xpo" Version="19.2.3" />
  </ItemGroup>
  <ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0'">
    <PackageReference Include="DevExpress.WindowsDesktop.Xaf" Version="19.2.3-ctp" />
  </ItemGroup>
</Project>

The sample has the following structure and dependencies:

For more information on .NET Core 3.0 and .NET Standard 2.0 support in XPO, see this documentation topic.

Your Feedback Matters

Are you developing cross-platform libraries like this? If so, please share your thoughts and tell us other about the challenges you’ve encountered.

Are you experimenting with .NET Core 3? We’d love to know more about your experiences and whether you expect to port an existing WinForms and/or WPF app?

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.