Click here to Skip to main content
Click here to Skip to main content

C# Portable Exe File

By , 26 May 2012
 

Introduction 

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.

Review

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.

License

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

About the Author

arthur zamarin
Israel Israel
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralMy vote of 5memberRohan Leuva15 May '13 - 21:15 
QuestionNot sure if I got the pointmemberjfriedman2 Jan '13 - 18:23 
Questiondoesn't workmemberarby7720 Aug '12 - 13:37 
AnswerRe: doesn't workmemberarthur zamarin20 Aug '12 - 17:25 
GeneralRe: doesn't workmemberarby7721 Aug '12 - 7:18 
AnswerRe: doesn't workmemberarthur zamarin21 Aug '12 - 7:22 
QuestionpfffmemberSergey Lapp9 Jul '12 - 22:48 
AnswerRe: pfffmemberarthur zamarin9 Jul '12 - 22:50 
GeneralRe: pfffmemberSergey Lapp10 Jul '12 - 0:10 
AnswerRe: pfffmemberarthur zamarin10 Jul '12 - 0:17 
GeneralRe: pfffmemberSergey Lapp10 Jul '12 - 0:23 
Question.NET EULAmemberivanicin3 Jun '12 - 7:05 
AnswerRe: .NET EULAmemberarthur zamarin3 Jun '12 - 7:26 
GeneralRe: .NET EULAmemberivanicin3 Jun '12 - 9:12 
GeneralMy vote of 2memberjohannesnestler29 May '12 - 23:53 
GeneralRe: My vote of 2memberarthur zamarin30 May '12 - 1:51 
QuestionQuestionmemberyogiCsharp29 May '12 - 20:12 
AnswerRe: Questionmemberarthur zamarin30 May '12 - 1:48 
QuestionDepends on CLR versionmemberNicolas Dorier28 May '12 - 10:41 
AnswerRe: Depends on CLR versionmemberarthur zamarin29 May '12 - 2:38 
GeneralRe: Depends on CLR versionmemberNicolas Dorier29 May '12 - 2:43 
GeneralRe: Depends on CLR versionmemberarthur zamarin30 May '12 - 1:54 
QuestionWhat ??memberJasper4C#28 May '12 - 1:43 
AnswerRe: What ??memberarthur zamarin28 May '12 - 2:30 
Questiontypo or notmemberpian_christian27 May '12 - 22:22 
AnswerRe: typo or notmemberarthur zamarin27 May '12 - 23:48 
GeneralMy vote of 5memberGixabel26 May '12 - 6:16 

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

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