如何在多台计算机上运行C#.exe文件? [英] How to run a C# .exe file on many computers?

查看:87
本文介绍了如何在多台计算机上运行C#.exe文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的计算机中安装了Microsoft Visual Studio 2010.我使用C#&它在Debug目录中创建了一个.exe文件.当我双击.exe文件时,可以在我的机器上打开它.但是,如果我复制该.exe文件并尝试在另一台计算机(没有Microsoft Visual Studio)上运行它,则它将无法正常工作.您能告诉我如何在任何计算机上运行.exe文件吗?或者,如果您知道解释它的网站.很久以前,我已经使用Winzip做到了这一点,并将所有库文件单独包含在.ext文件中.但不记得我是怎么做到的.有谁知道如何将我的所有库文件单独包含在.exe文件中.这样我可以在没有那些库文件的计算机上运行它?

I have Microsoft Visual Studio 2010 installed in my computer. I wrote a program using C# & it created a .exe file in the Debug directory. When I double click on the .exe file, I can open it on my machine. But if I copy that .exe file and try to run it on another computer, (that doesn't have Microsoft Visual Studio) it doesn't work. Can you please tell me how can I make a .exe file work on any computer? Or if you know a website that explains it. I have done this using Winzip long time ago and including all the library files alone with the .ext file. but don't remember how I did that anymore. Does any one knows how can I include all my library files alone with the .exe file. so I can run it on a computers that doesn't have those library files?

推荐答案

使用VS2010编译的程序可以针对各种.NET Framework.但是,Windows的许多版本并不总是安装最新的.NET版本.

Programs compiled with VS2010 can be targeted against a variety of .NET Frameworks. However, the many versions of Windows don't always have the most recent .NET versions installed.

通过在项目属性的 Application 标签下查看,来检查程序所使用的.NET Framework版本.您应该会看到一个目标框架下拉列表,该列表将告诉您其他计算机为了运行程序而需要安装的框架版本.

Check which version of the .NET Framework your program is using by looking under the Application tab of your project properties. You should see a Target Framework drop down list, which will tell you what version of the framework other computers will need to have installed in order to run your program.

您有一些选择可以使程序在其他计算机上运行.

You have a few options to get your program working on other computers.

  1. 使用其他较低的框架编译程序. ( eg .NET 2通常在Windows XP上可用,而.NET 4在此OS上并不常见.)只有在不使用更高版本的.NET的任何功能时,此功能才有效. /li>
  2. 在客户端计算机上安装所需的.NET框架. Microsoft提供了从 http://www.microsoft.com/net/download 下载和安装的框架.
  3. 尝试使用 Setup Project 模板创建Windows Installer.从设置和部署类别中将新项目添加到您的解决方案中.设置该项目后,您应该有一个安装程序可以在其他计算机上运行.
  1. Compile the program with a different, lower framework. (e.g. .NET 2 is often available on Windows XP, while .NET 4 is uncommon on this OS.) This will only work if you aren't using any features from later versions of .NET.
  2. Install the .NET framework you require on the client machine. Microsoft provides frameworks to download and install from http://www.microsoft.com/net/download
  3. Try creating a Windows Installer using the Setup Project template. Add a new project to your solution from the Setup and Deployment category. After setting up this project, you should have an installer to run on other machines.

这篇关于如何在多台计算机上运行C#.exe文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆