One of the disadvantages of C# is that when you want to run it, the computer must have .NET Framework installed on it. After this article, you will be able to make it runnable from any Windows without the must of .NET.
How to do it?
- Make a C# project.
- In Solution Explorer, inside your project, there is a line “Reference”. Click the plus near it. Now you can see all the dependencies of your project. Delete all references that aren’t used (delete, and try to run/build. If it is possible to do it, that it is unused. If there is an error, return it by adding it (right mouse click, “Add Reference”)).
- For each reference, go to Properties, and in the property “Copy Local” choose “True”. For each Image, Icon… make like to the referenced.
- Rebuild you project. Now in your Build/Release folder (inside bin) you will see many dll files. Those files have the information of every resource.
- Copy all the files in the folder (from step number 4) into a new folder.
- Go to the folder: “<windows folder>\Microsoft.Net\Framework\<latest version>” and copy the file “mscrolib.dll” to the new folder from step 5. If you don’t find this file, you can always make a search in the Hard Drive which contains Windows folder.
- Now your app is portable (with the whole folder content).
- All the referenced should be in the same folder as the .exe file.
- If something is missing, there may be problems with the program.
This solution is not the best. The whole program is heavy. But it is a solution! When you search the Internet, you will find such solutions like Portable Net, publish… But this one is quick, easy and does the right result.