Create a standalone .exe file

社会主义新天地 提交于 2019-12-22 05:54:09

问题


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.


回答1:


  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.




回答2:


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.



来源:https://stackoverflow.com/questions/20124051/create-a-standalone-exe-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!