How to run a C# .exe file on many computers?

两盒软妹~` 提交于 2019-12-01 03:20:30

问题


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?


回答1:


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.

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. 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.



回答2:


You will have to have the appropriate version of the .NET Framework installed on the computer you want to run your application on.




回答3:


This are the things that you need to do.

  1. Check if what OS version of your computer. If it's Windows XP check if it has .net framework 3.5 or to 4.0.You can download it here Microsoft .NET Framework 3.5

  2. Try to do Set up and deployment.

    Step-by-Step Process of Creating a Setup and Deployment Project

Best Regards



来源:https://stackoverflow.com/questions/13675826/how-to-run-a-c-sharp-exe-file-on-many-computers

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