Are you looking for some information about packaging .NET Core application with its dependencies and other files into a single executable file package? This tutorial shows how to do it step by step with the help of BoxedApp Packer.

.NET Core is a free and open-source software to build and run .Net applications. It's available on different platforms.

Beginning with the version .NET Core 2.1 offers a self-contained deployment, which produces an executable and includes a copy of the .NET Core runtime.

Both .NET application and .NET Core runtime comprise of a lot of files. It's a good idea to combine them into a single executable to simplify application distribution, hide and protect assets, sensitive code and data.

If you don't have .NET Core, download and install it from the official web site.

Run cmd.exe, create a directory for a sample project and create a simple project: mkdir V:\Projects\PackedDotNetCoreApp cd V:\Projects\PackedDotNetCoreApp dotnet new console dotnet run

.NET Core creates a project of a console application. Edit Program.cs:

static void Main(string[] args)
{
    Console.WriteLine("Hello World!");
    Console.WriteLine("Press any key to exit");
    Console.ReadKey();
}

Let's test if it works well. Build it and publish from command line:

dotnet publish PackedDotNetCoreApp.csproj -c Release -r win-x86 --self-contained true

The file V:\Projects\PackedDotNetCoreApp\bin\Release\netcoreapp2.2\win-x86\publish\PackedDotNetCoreApp.exe is created, you can launch it to check that it works well.

Start BoxedApp Packer, click on Select - Browse... and choose V:\Projects\PackedDotNetCoreApp\bin\Release\netcoreapp2.2\win-x86\publish\PackedDotNetCoreApp.exe. Then click on Add Files..., switch to folder V:\Projects\PackedDotNetCoreApp\bin\Release\netcoreapp2.2\win-x86\publish and add all the files except PackedDotNetCoreApp.exe:

Then click to Build and run packed executable. It works as expected: