If I am not wrong, it seems that I can publish an application in a single file, so I can get only only one exe file that contains all the needed to work.
First I have tried the publish wizard, and I check the option self contained, produce single file and ready to run. But I get about 300 files.
Then I have tried this command:
dotnet publish -r win-x64 -p:PublishSingleFile=true --self-contained true -p:IncludeNativeLibrariesInSingleFile=true -c Release -o publish
And I get the same result.
Also I have tried this:
dotnet publish -r win-x64 -p:PublishSingleFile=true true -p:IncludeNativeLibrariesInSingleFile=true -c Release -o publish
In this case I don't set the self contained because in somewhere I have read that is not needed when when single file is set, because if you want a single file, it is imply self contained. Anyway, I get always the same result.
My application is a wpf application in which I get an exe and I am using Net 5.
Which is the correct way to get a single .exe file?
Thanks.
PD: the documentation tells, in the publish wizard, I have to check the 3 checks that I check. But I don't get a unique file.
https://learn.microsoft.com/en-us/dotnet/core/deploying/single-file