Skip to content

How to compile a c# program

Alex

Asked Dec 3, 2005, 1:13 AM EST3 answers
Share
LinkedInX
Hi, I've done a simple C# program which creates a Windows form. I have a couple questons tough:
1. how do I associate it to an icon in Windows (i.e. on my desktop), so that when I double-click that icon, my form shows up? If I simply copy and paste that .cs file to my desktop now, when I open it I don't see the executable version of it, just the code, etc.

2. how can I make then a ".exe" or setup version of this .cs program? So that I can install and make it run in other computers, even if they haven't Mcsft Visual C# installed in them. In other words, what should I do to make this very basic program become an independent piece of software which can be run and installed anywhere?

I am using Visual C# express edition.

Any help would be much welcomed. Thx.

3 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    When you choose a window application and compile it then it forms a exe of your application in //bin/debug/Application_name.exe just copy that application and paste it onto the desktop so when you click it you will see your application not the code
    0
  • 0
    Good. I'd have another question for now: when i launch the .exe file of the "Helllo World!" program, or anything equivalent, which is a console application I think, it just shows up for half a second (maybe even less...) and then disappears. I cannot even read the words! Is there a way to have it stay on the screen for longer a few seconds maybe, or to have it stay there for "ever" and not disappear, unless i push enter (or something else)? Thanks again.
    0
  • 0

    try using Console.ReadLine() at the end of your code

    0