0

I am new to .net application development. I have made small application. If I take only one application.exe file to another folder from my project file and try to launch, it does not launch. But If I take all .dlls and config file with it, it launces fine. Now I want to launch Applicaiton with only .exe file. So what should I do? Do I have to package them all in one? If yes, then how?

EluciusFTW
  • 2,565
  • 6
  • 42
  • 59
Dhruv Gohil
  • 842
  • 11
  • 34
  • Why in the world does the small application that you just made, as a newbie to .NET programming, require a bunch of DLLs? Each DLL corresponds to a separate project in your solution, set to output a library. It's unlikely that you need the code separated that way for a small application. Just put everything in one project and generate one EXE. Note, of course, that your users will still need the .NET Framework installed on their machines. Copying the EXE around may not be enough. Investigate using an installer that can automate the process. – Cody Gray - on strike Feb 05 '16 at 14:37
  • @CodyGray I doubt he has multiple projects in his solution, far more likely he is using a NuGet package or two included in his project so the dll's are 3rd party. – Scott Chamberlain Feb 05 '16 at 14:39

2 Answers2

0

Look into ILMerge.

If you absolutely want to have just a single binary, it can be used to merge .NET assemblies into a single assembly.

But typically you will distribute your application with its dependencies, and use some setup project to package it all.

Stokke
  • 1,871
  • 2
  • 13
  • 18
  • There are much better methods than using ILMerge now a days, use `AppDomain.CurrentDomain.AssemblyResolve` and [have it resolve to a embedded resource](http://blogs.msdn.com/b/microsoft_press/archive/2010/02/03/jeffrey-richter-excerpt-2-from-clr-via-c-third-edition.aspx), check the linked page for the name `Mike Barnett`, that is the author of ILMerge, even he agrees if he knew about using `AssemblyResolve` he would have never written ILMerge. You can use libraries like [Fody.Costura](https://github.com/Fody/Costura) to automate the process. – Scott Chamberlain Feb 05 '16 at 14:44
0

Well all the files in the bin/Debug or Release folder is what you need to run your application / exe.

There are many guides on how to create a setup project to create an MSI to install your application on any machine. That will take care of all the references, files and setup

http://www.codeproject.com/Articles/568476/Creating-an-MSI-Setup-Package-for-Csharp-Windows

Ggalla1779
  • 476
  • 7
  • 18