Create a New .NET Core WPF Application
- 3 minutes to read
This tutorial describes how to use DevExpress project templates to create a .NET Core WPF application with DevExpress Controls.
Use Visual Studio
The DevExpress .NET Core 3 Desktop Product installation integrates project templates into Visual Studio.
Tip
To follow the instructions in this section, install DevExpress .NET Core 3 Desktop products.
Follow the steps below to create a new application.
Run Visual Studio 2019. In the start dialog, select Create a new project.
In the Create a new project dialog, search for DevExpress .NET Core WPF application templates. Select a project template and click Next.
Specify the project name and solution location. Click Create.
Tip
Build the application to resolve its NuGet dependencies.
Use the Console
Note
The command-line project templates are available only in online DevExpress NuGet feed.
The command-line project templates require .NET Core 3.1 SDK.
You can use the .NET Core command line interface (CLI) to create a .NET Core WPF application from the console:
Refer to the https://nuget.devexpress.com/#feed-url page and obtain your NuGet Feed URL. This URL includes your personal feed authorization key and is used to install your licensed or trial DevExpress NuGet packages, including DevExpress WPF UI for .NET Core.
Add the obtained URL to NuGet sources.
Open the
%appdata%\NuGet\NuGet.Config
file and add the obtained URL to the<packageSources>
section:<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <add key="Microsoft Visual Studio Offline Packages" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\" /> <add key="Nuget" value="https://nuget.org/api/v2" /> <!-- Add your personal feed URL --> <add key="DevExpress" value="https://nuget.devexpress.com/{your-feed-authorization-key}/api" /> </packageSources> ... </configuration>
Save and close the config file.
Install DevExpress project templates for .NET Core WPF apps:
dotnet new -i DevExpress.WindowsDesktop.Wpf.ProjectTemplates.v19.2
The command output displays a list of installed templates:
Templates Short Name Language Tags --------------------------------------------------------------------------------------------------------------------------------------------------- Console Application console [C#], F#, VB Common/Console Class library classlib [C#], F#, VB Common/Library WPF Application wpf [C#] Common/WPF WPF Class library wpflib [C#] Common/WPF WPF Custom Control Library wpfcustomcontrollib [C#] Common/WPF WPF User Control Library wpfusercontrollib [C#] Common/WPF Windows Forms (WinForms) Application winforms [C#] Common/WinForms Windows Forms (WinForms) Class library winformslib [C#] Common/WinForms Worker Service worker [C#] Common/Worker/Web DevExpress v19.2 WPF Blank Application (.NET Core) dxwpf192 [C#], VB DevExpress/WPF DevExpress v19.2 WPF MVVM Application (.NET Core) dxwpfmvvm192 [C#], VB DevExpress/WPF DevExpress v19.2 WPF Dashboard Viewer Application (.NET Core) dxwpfdashboard192 [C#], VB DevExpress/WPF DevExpress v19.2 WPF Ribbon Application (.NET Core) dxwpfribbon192 [C#], VB DevExpress/WPF Unit Test Project mstest [C#], F#, VB Test/MSTest NUnit 3 Test Project nunit [C#], F#, VB Test/NUnit ...
Create a new application using any of the commands below:
# Creates a new blank application dotnet new dxwpf192 -n MyWpfProject -o MyWpfSolution # Creates a new application with Ribbon control and Visual Basic code dotnet new dxwpfribbon192 -n MyWpfProjectVB -o MyWpfSolutionVB -lang VB
Build and run the new application:
# Build the blank application dotnet build .\MyWpfSolution\MyWpfProject.csproj # Run the blank application dotnet run --project .\MyWpfSolution\
Project Templates
Template Name | Description | Components in Use |
---|---|---|
DevExpress v19.2 WPF Blank Application (.NET Core) | An empty application with a ThemedWindow. | ThemedWindow |
DevExpress v19.2 WPF MVVM Application (.NET Core) | An empty MVVM application. | MVVM Framework, ThemedWindow |
DevExpress v19.2 WPF Dashboard Viewer Application (.NET Core) | A dashboard viewer application that shows a dashboard created at design time. | DashboardControl |
DevExpress v19.2 WPF Ribbon Application (.NET Core) | An application with Ribbon-based toolbars. | RibbonControl, RibbonStatusBarControl, ThemedWindow |