发布 C# 控制台应用程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13374017/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Publishing C# console application
提问by 10e5x
I have developed a C# console application using VS2010. Now i would like to make it into a setup.exe. Is it possible to have this setup.exe as a standalone file to run my program? Meaning how can i achieve in obtaining setup.exe that when i click on that file it will run my console without even opening VS and without the need of my project folder on the workstation. I have tried numerous time doing myself but failed up till now. Some advice please.
我已经使用 VS2010 开发了一个 C# 控制台应用程序。现在我想把它变成一个setup.exe。是否可以将此 setup.exe 作为独立文件来运行我的程序?这意味着我如何在获取 setup.exe 时实现,当我单击该文件时,它将运行我的控制台,甚至无需打开 VS,也不需要工作站上的项目文件夹。我已经尝试过很多次自己做,但到目前为止都失败了。请给一些建议。
Thanks, 10e5x
谢谢,10e5x
采纳答案by Freelancer
You can publish it. Go to your solution explorer. Right click on it. publish the application. After finishing the publishing wizard, you can get the set up file in publish folder. or you can simply copy the exe file directly from the Bin folder and paste it wherever you want. Hope this is helpful.
你可以发布它。转到您的解决方案资源管理器。右键单击它。发布应用程序。完成发布向导后,您可以在发布文件夹中获取设置文件。或者您可以直接从 Bin 文件夹中复制 exe 文件并将其粘贴到您想要的任何位置。希望这是有帮助的。
回答by Sohail
Follow the Steps
按照步骤
1) Firslty build the code 2) Then go to your projects folder 3) Open Debug/Bin 4) Inside Bin you can see the exe file. That file you can copy on any work station and run your console application.
1) 首先构建代码 2) 然后转到您的项目文件夹 3) 打开 Debug/Bin 4) 在 Bin 内您可以看到 exe 文件。您可以在任何工作站上复制该文件并运行您的控制台应用程序。
Please do remember be confirm in which .NET version ur program is compiled. If suppose you compiled your program in .NET version 3.5 and running your program in .NET version 2 . It will not work
请记住确认您的程序是在哪个 .NET 版本中编译的。如果假设您在 .NET 版本 3.5 中编译您的程序并在 .NET 版本 2 中运行您的程序。不起作用
Thanks
谢谢

