I have a C# .NET Core 2.0 console app. I want to deploy it so it is a single .exe
file with all associated .dll
included in the .exe
.
Is this possible?
The reason I want to do this is I have made several console apps and I want to put them in the same folder so that only 1 path entry is required to make them available from the command line.
If I publish with dotnet publish -c Release -r win10-x64
I get an .exe
but I also get a load of other files.
Is there anyway to either move all these associated files to a named subfolder or to wrap them all up in a single file?
No, right now .NET Core does not support producing a single .exe that contains your entire application.
And don't be confused when you read about self-contained
apps. Self-contained means that application is published for a specific OS by specifying the target runtime (like -r win10-x64
) and this allows not to have the .NET Core as the shared runtime in the target machines.
You can pack your applications in a single executable with the help of BoxedApp. Here is a guide on how to do this
There is a tool called Warp that wraps up the package into a single application file.
(And hopefully it will be supported in .NET Core 3+ as a Single-File feature:
https://github.com/dotnet/designs/blob/master/accepted/single-file/design.md )
I know this question is a few years old but now finally, this is possible with .NET Core.
You can achieve this in two different ways
1.Package Manager Console
dotnet publish -r win-x64 -c Release /p:PublishSingleFile=true
You can find more info from the links below
https://docs.microsoft.com/en-us/dotnet/core/deploying/single-file
https://dotnetcoretutorials.com/2019/06/20/publishing-a-single-exe-file-in-net-core-3-0/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.