使用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.
- 使用其他较低的框架编译程序. ( eg .NET 2通常在Windows XP上可用,而.NET 4在此OS上并不常见.)只有在不使用更高版本的.NET的任何功能时,此功能才有效. /li>
- 在客户端计算机上安装所需的.NET框架. Microsoft提供了从 http://www.microsoft.com/net/download 下载和安装的框架.
- 尝试使用 Setup Project 模板创建Windows Installer.从设置和部署类别中将新项目添加到您的解决方案中.设置该项目后,您应该有一个安装程序可以在其他计算机上运行.
- 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.
- Install the .NET framework you require on the client machine. Microsoft provides frameworks to download and install from http://www.microsoft.com/net/download
- 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.