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
In Visual Studio’s main menu, select File | New | Project… to invoke the Create a new project dialog.
Select DevExpress v24.2 XAF Template Gallery and click Next.
Specify the project name (SimpleProjectManager) and click Create.
In the invoked Template Gallery window, switch to the .NET section. Select XAF Solution Wizard (.NET) and click Run Wizard.
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 Entity Framework Core ORM library.
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.
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.
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.
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.
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.
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
- Windows Forms
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