如何从 Visual Studio 2012 导出 C# 应用程序以在其他计算机上运行?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17236339/
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
how can I export a C# application from Visual Studio 2012 to run in other computers?
提问by Erik Scheffer
I just made my first C# application in Visual Studio 2012 and I want to export it in some way so other people could use it in they computers (including computers without Visual Studio 2012). How can I do it? I'm new at C# and I couldn't find anything that I could understand. Can someone explain or indicate some site with a good (and maybe didactic) explanation on how it works? I have only made C/C++ programs by now, and they I just needed the .exe file, but, based on what I could find, I need something else to send a C# program to others to use. Sory for the bad English and thanks for those who help.
我刚刚在 Visual Studio 2012 中制作了我的第一个 C# 应用程序,我想以某种方式导出它,以便其他人可以在他们的计算机(包括没有 Visual Studio 2012 的计算机)中使用它。我该怎么做?我是 C# 新手,找不到任何我能理解的东西。有人可以解释或指出一些网站,并对其工作原理进行很好的(也许是说教的)解释吗?我现在只制作了 C/C++ 程序,他们我只需要 .exe 文件,但是,根据我能找到的,我需要其他东西来将 C# 程序发送给其他人使用。抱歉英语不好,感谢那些提供帮助的人。
采纳答案by dasblinkenlight
Right-click the project in VS 2012, and choose Publish...from the context menu. Publishing to a file lets you create an installer:
在 VS 2012 中右键单击该项目,然后Publish...从上下文菜单中进行选择。发布到文件可让您创建安装程序:
- Choose a location in the file system to which you would like to save the installer
- Click
[Finish] - Wait for the publishing operation to complete
- 在文件系统中选择要保存安装程序的位置
- 点击
[Finish] - 等待发布操作完成
A Setup.exeinstaller file will be created at the location that you have selected in the first step of the publish wizard. Share the installer with the people to whom you would like to give your application.
一个Setup.exe安装程序文件将在你在的向导发布第一步选择的位置创建。与您希望向其提供应用程序的人员共享安装程序。
回答by SLaks
After building your project, you will find an EXE file in bin\(Debug or Release)
构建项目后,您将在其中找到一个 EXE 文件 bin\(Debug or Release)
回答by Edmund Covington
You need any computer that wants to run it to be windows, and running the correct version of the .net framework. If it's a program that's created with VS2012, that'll be .net 2.0 to 4.5.2. After that, you need to find the location of your program, and you can just copy the debug folder that you are currently running from, and your program will work.
您需要任何想要运行它的计算机都是 Windows,并运行正确版本的 .net 框架。如果它是用 VS2012 创建的程序,那就是 .net 2.0 到 4.5.2。之后,您需要找到您的程序所在的位置,您只需复制您当前正在运行的调试文件夹,您的程序就可以运行了。
回答by Stef Kostas
Check also the .net framework that it is required in order for c# apps to run. You can find what framework your app is build in projext properties. If the target computer has an old os (XP) maybe the .net framework needs also to be installed
还要检查运行 c# 应用程序所需的 .net 框架。您可以在 projext 属性中找到您的应用程序构建的框架。如果目标计算机有旧操作系统(XP),可能还需要安装 .net 框架

