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

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.