#Net6 – Single file apps improved for Windows and Mac !

Buy Me A Coffee

Hi !

Some time ago I wrote about how to package a .Net Winform application in a one-self contained file. I also tested how was to migrated a Net 4.8 project to Net 5 and it was super easy. I was reading the notes about the new .Net 6. Preview 1 and I got stuck in this sentence.

In .NET 6, single file apps have been enabled for Windows and macOS. In .NET 5, single files apps were limited to Linux. In .NET 6, for all supported operating systems, you can publish a single-file binary that has exactly one file on disk and does not need to extract any of the core runtime assemblies to temporary directories.

This is super cool, now we have this feature available for Windows!

So, I went back to my test project and made a few changes

1st change, set the target framework to use Net 6

vs2019 project target framework net 6 preview 1

Then I created a publish profile using folder as destination location.

publish profile to local folder

And I set the following values in the Profile Settings

publish profile settings for single file

Now it was time to publish, and I find my single file ready to use !

This is super cool, however the previous configuration is Framework Dependent. Let’s change the settings for Self Contained.

I got more files !

And it makes sense. The official doc explains this.

There are cases where a single file app will have more than one file. WPF native dependencies are not part of the superhost, resulting in additional files beside the single file app. The same is true for any other native binaries that you happen to depend on.

Happy coding!


El Bruno

More posts in my blog ElBruno.com.

More info in https://beacons.ai/elbruno


¿Con ganas de ponerte al día?

En Lemoncode te ofrecemos formación online impartida por profesionales que se baten el cobre en consultoría:



Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: