Click here to Skip to main content
13,248,766 members (44,422 online)
Click here to Skip to main content
Add your own
alternative version


49 bookmarked
Posted 26 May 2012

C# Portable Exe File

, 26 May 2012
Rate this:
Please Sign up or sign in to vote.
Making an exe file from C# project that runs from any Windows, without must of Net Framework instaled.


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?

  1. Make a C# project.
  2. 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")).
  3. For each reference, go to Properties, and in the property "Copy Local" choose "True". For each Image, Icon... make like to the referenced.
  4. 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.
  5. Copy all the files in the folder (from step number 4) into a new folder.
  6. Go to the folder: "<windows folder>\Microsoft.Net\Framework\<latest version>" and copy the file "mscorlib.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.
  7. 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.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

No Biography provided

You may also be interested in...

Comments and Discussions

GeneralMy vote of 1 Pin
flash-mmb20-May-17 3:57
memberflash-mmb20-May-17 3:57 
GeneralMy vote of 5 Pin
Eng Mohamed Bassuny5-Aug-16 12:57
memberEng Mohamed Bassuny5-Aug-16 12:57 
QuestionSimple! Pin
thisisthemurph7-Jul-15 22:31
memberthisisthemurph7-Jul-15 22:31 
QuestionNot work on server 2008 machine Pin
Beniwal0130-May-14 0:18
memberBeniwal0130-May-14 0:18 
GeneralMy vote of 5 Pin
Rohan Leuva15-May-13 22:15
memberRohan Leuva15-May-13 22:15 
QuestionNot sure if I got the point Pin
jfriedman2-Jan-13 19:23
memberjfriedman2-Jan-13 19:23 
Questiondoesn't work Pin
arby7720-Aug-12 14:37
memberarby7720-Aug-12 14:37 
AnswerRe: doesn't work Pin
arthur zamarin20-Aug-12 18:25
memberarthur zamarin20-Aug-12 18:25 
GeneralRe: doesn't work Pin
arby7721-Aug-12 8:18
memberarby7721-Aug-12 8:18 
AnswerRe: doesn't work Pin
arthur zamarin21-Aug-12 8:22
memberarthur zamarin21-Aug-12 8:22 
GeneralRe: doesn't work Pin
Beniwal0130-May-14 0:29
memberBeniwal0130-May-14 0:29 
Questionpfff Pin
Sergey Lapp9-Jul-12 23:48
memberSergey Lapp9-Jul-12 23:48 
AnswerRe: pfff Pin
arthur zamarin9-Jul-12 23:50
memberarthur zamarin9-Jul-12 23:50 
GeneralRe: pfff Pin
Sergey Lapp10-Jul-12 1:10
memberSergey Lapp10-Jul-12 1:10 
AnswerRe: pfff Pin
arthur zamarin10-Jul-12 1:17
memberarthur zamarin10-Jul-12 1:17 
GeneralRe: pfff Pin
Sergey Lapp10-Jul-12 1:23
memberSergey Lapp10-Jul-12 1:23 
Question.NET EULA Pin
ivanicin3-Jun-12 8:05
memberivanicin3-Jun-12 8:05 
AnswerRe: .NET EULA Pin
arthur zamarin3-Jun-12 8:26
memberarthur zamarin3-Jun-12 8:26 
GeneralRe: .NET EULA Pin
ivanicin3-Jun-12 10:12
memberivanicin3-Jun-12 10:12 
GeneralMy vote of 2 Pin
johannesnestler30-May-12 0:53
memberjohannesnestler30-May-12 0:53 
GeneralRe: My vote of 2 Pin
arthur zamarin30-May-12 2:51
memberarthur zamarin30-May-12 2:51 
QuestionQuestion Pin
yogiCsharp29-May-12 21:12
memberyogiCsharp29-May-12 21:12 
AnswerRe: Question Pin
arthur zamarin30-May-12 2:48
memberarthur zamarin30-May-12 2:48 
QuestionDepends on CLR version Pin
Nicolas Dorier28-May-12 11:41
memberNicolas Dorier28-May-12 11:41 
AnswerRe: Depends on CLR version Pin
arthur zamarin29-May-12 3:38
memberarthur zamarin29-May-12 3:38 
GeneralRe: Depends on CLR version Pin
Nicolas Dorier29-May-12 3:43
memberNicolas Dorier29-May-12 3:43 
GeneralRe: Depends on CLR version Pin
arthur zamarin30-May-12 2:54
memberarthur zamarin30-May-12 2:54 
QuestionWhat ?? Pin
Jasper4C#28-May-12 2:43
memberJasper4C#28-May-12 2:43 
AnswerRe: What ?? Pin
arthur zamarin28-May-12 3:30
memberarthur zamarin28-May-12 3:30 
Questiontypo or not Pin
pian_christian27-May-12 23:22
memberpian_christian27-May-12 23:22 
AnswerRe: typo or not Pin
arthur zamarin28-May-12 0:48
memberarthur zamarin28-May-12 0:48 
GeneralMy vote of 5 Pin
Gixabel26-May-12 7:16
memberGixabel26-May-12 7:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.171114.1 | Last Updated 26 May 2012
Article Copyright 2012 by arthur zamarin
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid