WinForms - Single-File Applications With .NET Core 3

WinForms Team Blog
20 May 2019

Shortly after Microsoft announced WinForms support for .NET Core 3, we published a blog post to confirm our commitment to .NET Core. Recently Microsoft posted about .NET Core 3 Preview 5 and their long-term plans. An interesting .NET Core feature is the support for single-file executable AOT-compiled apps. Read on to find out how to use this functionality with one of the DevExpress WinForms demos for .NET Core 3.


First, you need to install the .NET Core 3 Preview 5 SDK. For the purposes of this article, the SDK is all you need – for your own projects, the latest Visual Studio 2019 should also be available.

Clone the GitHub repository DevExpress .NET Core WinForms Demos on your machine, using Git command line tools or Visual Studio, or by downloading a zip file.

Note that the file in the repository contains instructions to work with the demos in Visual Studio. However, this is not required to see the single-file executable publication mechanism in action.

Test Single-File Executable Publication

Open a command prompt and use the cd command to navigate to the StockMarketTraderApp demo folder. Run the command dotnet publish -r win10-x64 to build and publish the solution.

The parameter -r win10-x64 identifies the target platform for the application. See the article .NET Core RID Catalog for more information.

For most real-world scenarios you should add the parameter -c Release to build the application using the Release configuration. Otherwise, it will be built using Debug.

In the demo folder, navigate to the newly created directory \bin\Debug\netcoreapp3.0\win10-x64\publish (or \bin\Release\netcoreapp3.0\win10-x64\publish if you added -c Release) The folder contains more than 340 files that you need to distribute to your end-users, including assemblies for your own application logic, standard .NET and DevExpress assemblies. Building for the Release configuration produces fewer files, but the difference is not large.

Standard Publication Folder

Run DevExpress.StockMarketTrader.exe and check the memory consumption in the task manager. On our test machine the value varied between 220 and 260 MBytes.

Memory Consumption for Multi-File Executable

To test single-file executable publication, delete the folder bin. Now run the dotnet publish command again, but this time add a parameter to set the PublishSingleFile property for MSBuild:

dotnet publish -r win10-x64 -c Release -p:PublishSingleFile=true

Check the auto-generated publish folder again, in the same path as before. This time you’ll see a single file, a 267-megabyte self-extracting executable.

Single-File Publication Folder

This file runs the StockMarketTrader demo on any Windows 10 x64 bit machine and contains everything the application needs in one file.

The Running Application

The first application launch takes a bit longer than for a multi-file deployment, since all dependencies are unpacked into a temporary folder in %AppData%.

Temporary AppData Folder

On further runs, there are no penalties on startup time or memory consumption.

Memory Consumption for Single-File Executable

More Information

Microsoft promises that by the time of the .NET 5 release you will be able to publish single-file executables created by the ahead-of-time (AOT) compiler, as an alternative to the self-extracting executables available now. We are watching all .NET Core updates closely to make sure our controls and components fully support all new features.

Several design documents are available about single-file publication. If you’re curious, please check out these links:

DevExpress Winforms For .NET Core 3

DevExpress NuGet packages are available to use our WinForms components with .NET Core 3. We recently updated these packages with support for additional assemblies, and everything is now built natively with .NET Core 3.

Here is the demo link again. The paragraph Integrate DevExpress WinForms Controls into a .NET Core 3 application of the Readme has instructions for the early-access NuGet feed.

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.