Skip to main content

Create a Cross-Platform .NET App UI Application

  • 3 minutes to read

This topic describes how to use the Solution Wizard to create a Cross-Platform .NET App UI (XAF) application and specify a database connection string.

Step-by-Step Instructions

  1. In Visual Studio’s main menu, select File | New | Project… to invoke the Create a new project dialog.

    Create a new project, DevExpress

  2. Select DevExpress v24.1 XAF Template Gallery and click Next.

    Select XAF Template Gallery, DevExpress

  3. Specify the project name (SimpleProjectManager) and click Create.

    Specify a name for the new project, DevExpress

  4. In the invoked Template Gallery window, switch to the .NET section. Select XAF Solution Wizard (.NET) and click Run Wizard.

    Select "XAF Solution Wizard" in the Template Gallery, DevExpress

  5. On the first page of the Solution Wizard, you can select target platforms. Select two options – Desktop (Windows Forms) and Web (ASP.NET Core Blazor). Click Next.

    Choose the UI platform, DevExpress

  6. Choose the Entity Framework Core ORM library.

    Choose the Entity Framework Core ORM library, DevExpress

    Tip

    For additional information on how to choose an ORM that suits your needs, refer to the following topic: Why We Recommend EF Core over XPO for New Development.

  7. In the next window, you can enable XAF’s functional testing and multitenancy capabilities. Do not select anything and continue to the next step since these options are not required for this tutorial.

    Skip Functional Testing and Multitenancy, DevExpress

  8. In this window you can choose an authentication type for your application. Do not select anything and continue to the next step since the XAF Security System is not required for this tutorial. Click Next.

    Choose the authentication type, DevExpress

  9. On this page, you can select the ready-to-use XAF modules you want to add to your application. For the purposes of this tutorial, deselect everything and click Finish.

    Choose additional modules, DevExpress

Solution Structure

The solution contains the following projects:

SimpleProjectManager.Module
A module project that contains platform-independent code. Use this project to define the data model and change UI settings of all target platforms.
SimpleProjectManager.Blazor.Server
An ASP.NET Core Blazor application that generates a user interface based on the data model you define in SimpleProjectManager.Module.
SimpleProjectManager.Win
A Windows Forms application that generates a user interface based on the data model you define in SimpleProjectManager.Module.

SPM_SolutionExplorer

Refer to the following topic for more information on projects in an XAF solution: Application Solution Structure.

Database Connection

When you create a new application, the application wizard attempts to find an installed Microsoft SQL Server instance (LocalDB or Express) and sets the connection string accordingly. You can also connect to a different database system as described in the following topic: Connect an XAF Application to a Database Provider.

First Run

Now you can run the application. Click Start Debugging or press F5.

The ASP.NET Core Blazor project is set as the startup project. To run the Windows Forms application, right-click the SimpleProjectManager.Win project in the Solution Explorer and select the Set as Startup Project option in the context menu.

The following images show the resulting ASP.NET Core Blazor and Windows Forms applications:

ASP.NET Core Blazor
Simple Project Manager ASP.NET Core Blazor first run, DevExpress
Windows Forms
Simple Project Manager Windows Forms first run, DevExpress

XAF creates the application’s UI based on the supplied data model. Since you did not create any entity classes yet, the first run shows a basic version of the application.

Next lesson

Define the Data Model and Set the Initial Data

See Also