Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a standalone .exe file

I have a console application built in visual studio 2010.

When I actually build the project I am getting .exe file under \bin\Debug\MyProj.exe.

When I Paste and run this .exe from other location it is expecting other files too.

Any thoughts how can I make this as Stand alone exe file.

like image 743
Patan Avatar asked Nov 21 '13 14:11

Patan


2 Answers

  1. There should be other DLL's in the Debug library. You need those to run your exe.

  2. If there are no DLL's there, make sure you set the 'Copy local' property of the required references to True, and build again.

  3. If you want to make a standalone program, you should create a new Setup project in your solution. Include the Primary Output from your application project, and the setup should include the required DLL's automatically. Once you build the setup project, you can install your application as a standalone software.

like image 174
Marton Avatar answered Oct 02 '22 14:10

Marton


You usually distribute application with bunch of DLLs, that's nothing bad.

But if you really want to make it a single exe, you can look here - same question is answered Embed .net dll in c# .exe . (Valid if your DLLs are also .Net assemblies)

Edit: If you need to easily distribute app to not-very-computer-friendly users, consider also trying ClickOnce. It's roughly something like Java Web start - only disadvantage is that you can't get "Windows Logo" certificate from Microsoft for projects distributed that way.

like image 40
eMko Avatar answered Oct 02 '22 15:10

eMko