Reputation: 1340
I've got a question regarding .NET applications and the executable that is made with the release of the application. Right now I've made my application, and it's working as intended, and I know that in the Release folder you have to final application. It works, you can run it, but my problem is in distribution.
There are a lot of extra files generated by it, and probably because of that's what it needs to get running. But is there a possibility that I can wrap everything in a package so that I can distribute one file of ~2-3mb instead of a zip file containing every file individually.
I don't want to use a setup for my applicaton, because it's very small and a standalone application is better for me. Thanks in advance!
EDIT: It's for the most part DLL and XML files, see this image: https://i.sstatic.net/UnqeT.jpg
Upvotes: 0
Views: 2685
Reputation: 6221
This what I use personally for additional application files (i.e. database scripts, images, dictionaries or whatever arbitrary data files). I did not try this approach with assemblies though.
If you do not want to use setup, an option is to embed external files as executable application resources and extract them to application or temporary directory upon first run.
Files.resx
) to your projectmyResourceLabel
); make sure Visual Studio treats it as "FILE" resource and not i.e. "IMAGE" (it is enough to use extension ".dat" as file extension).
if (!System.IO.File.Exists("myfile.dat"))
System.IO.File.WriteAllBytes("myfile.dat", Files.myResourceLabel);
Upvotes: 0
Reputation: 1580
I highly recommend to use Costura.Fody - by far the best and easiest way to embed resources in your assembly. It's available as NuGet package.
Install-Package Costura.Fody
Upvotes: 1
Reputation: 301
You could use ILmerge. Its a nuget package from here https://www.nuget.org/packages/ilmerge. It can combine all the libraries and *.exe into one assembly. It is reliable and you can add it as part of your build events. Specifically as a Post Build Event when in release mode.
Upvotes: 3