How I can publish my C# windows form app as a single exe file?

I use .net 4.8.1 and I googled I found I can use dotnet publish but did not work I think because this .net I use is old. Is there an easy and fast way to do that ?

I have many dependencies dlls

Tell your app’s publish settings you are specifically targetting it on x64 (or x86), and it should gain a little dropdown menu at the bottom, which should include the option for “Publish single file” or something to that effect.

The system cant generate a single-file executable for generic/multiplatform/“Portable” applications.

image

(Before)

image
(After. The only difference being that i’ve told it i’m targetting Win-x64.)

1 Like

Thanks but I get this:

Error NETSDK1125 : Publishing to a single-file is only supported for netcoreapp target.

then 4.8.1 doesnt support it. you’d need to step up to .NET Core of some flavor (my pictures above are from .NET Core 6, but Core 8 is the ‘newest’)

1 Like