5

I'm using Visual Studio 2013

I just made my first windows app with it (a windows forms) and, if its possible, I would like to embed the libraries and config/manifest etc files into a single executable file, for more convenience. Can it be done? If so how?

Thanks a lot

CyborgFish
  • 356
  • 6
  • 13
  • For more convenience? Why is that more convenient? – rory.ap Feb 26 '15 at 18:42
  • What libraries are you talking about? NET Framework should be installed in any case or do you have thirdy party libraries? And the config file really should be kept external to your application otherwise is no more 'configurable' – Steve Feb 26 '15 at 18:45
  • I'm not sure ILMerge will do the app config. – BradleyDotNET Feb 26 '15 at 18:46
  • @Steve It doesnt need to be configurable anyway, it downloads everything needed from a server everytime its executed. Besides net framework having to be installed, is there a way to avoid shipping files like config, manifest, vshost, and library dlls (JSON.NET in this case) with it? – CyborgFish Feb 26 '15 at 18:48
  • [Create an installer](http://stackoverflow.com/questions/20351947/). – Dour High Arch Feb 26 '15 at 18:49
  • You could make an executable zip file if all you want to do is bundle everything into a single exe – Fuzzy Logic Feb 26 '15 at 18:50
  • Well deploying only one file without the need to install certainly is convenient for small things.. – TaW Feb 26 '15 at 19:24

1 Answers1

2

You should not be deploying all the files in the bin\Release folder anyway. The vshost files are for debugging within Visual Studio, they should not be deployed. The pdb file is for debugging and does not need to be deployed. If your application doesn't use the config file for anything you don't need to deploy it. You will need to deploy any additional assemblies though, which you may be able to solve using ILMerge.

Having said that, my recommendation would be to either create an installer or create a self-executing archive (zip or 7z) over trying to use ILMerge to get any third-party assemblies deployed with your application.

UPDATE

Just to be clear, here's a list of files from a default WinForms app to which I added JSON.NET (Release build):

  • Newtonsoft.Json.dll
  • Newtonsoft.Json.xml
  • WindowsFormsApplication1.exe
  • WindowsFormsApplication1.exe.config
  • WindowsFormsApplication1.pdb
  • WindowsFormsApplication1.vshost.exe
  • WindowsFormsApplication1.vshost.exe.config
  • WindowsFormsApplication1.vshost.exe.manifest

If the app doesn't use the config file, the only files you need to deploy are Newtonsoft.Json.dll and WindowsFormsApplication1.exe

Craig W.
  • 17,838
  • 6
  • 49
  • 82
  • Okay thank you, I will consider doing it as a self archive thing. As its my first app for windows I actually expected it to be a standalone executable with everything embedded, but I actually dont mind releasing it with a couple more files in a folder if its necessary, as one of my fears was coming across as a noob for releasing it like this :p – CyborgFish Feb 26 '15 at 20:06