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?

- 503
- 2
- 6
- 8
-
Have you installed the .net framework on the other computer? Does it give any meaningful error? – Dave Lucre Dec 03 '12 at 01:12
-
You need to make sure that the .Net Runtime and all required dll's are installed on any computer you want to run your program on. You would be better off creating an Install Program to make sure your prerequisites are installed as well as your program. – Mark Hall Dec 03 '12 at 01:14
-
You can download the appropriate .NET framework installer from the Microsoft Download Center: http://www.microsoft.com/en-us/download/search.aspx?q=.net+framework+redistributable – CodingWithSpike Dec 03 '12 at 01:17
-
"it doesn't work" - can you elaborate? – Blorgbeard Dec 03 '12 at 01:48
-
Thanks for all the replies, Got it working – Hope S Dec 03 '12 at 02:23
3 Answers
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.
- 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.

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

- 187,200
- 47
- 362
- 445
This are the things that you need to do.
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
Try to do Set up and deployment.
Step-by-Step Process of Creating a Setup and Deployment Project
Best Regards

- 6,048
- 9
- 40
- 62