How to: Build and Execute Your Visual C# Application
To build and execute your C# program, press F5. It's that simple.
Of course, behind the scenes, a lot of things are occurring. Before a C# program can be executed, it must be compiled into the intermediate form that all .NET Framework languages understand, Microsoft intermediate language, or MSIL. For more information about MSIL, see C# and the .NET Framework.
When you press F5, or click Start or Start Without Debugging on the Debug menu, the conversion occurs and the executable file is created.
You will find your program's executable file, that is, the file that ends with .exe, stored in one or both of the following locations:
My Documents\Visual Studio 2008\Projects\<Project Name>\<Project Name>\bin\Debug
-or-
My Documents\Visual Studio 2008\Projects\<Project Name>\<Project Name>\bin\Release
There are two possible locations because there are two possible forms of the executable file. When you press F5, a version of your executable with extra debugging information is created. This is the file that is put in the Debug directory.
If you click Build Solution on the Build menu, or press CTRL+F5, or click Start Without Debugging on the Debug menu, a version of your executable without debugging information is created.
Typically, you would work with the debug version of your executable file during development, and then create the retail version when you have to share or deploy your finished application. For more information, see How to: Deploy Your Visual C# Express Application.
If there are any errors in your C# syntax, or identifiers that cannot be resolved to a known type or member, your build will not succeed. A list of errors appears in the Error List Window, which appears by default directly below the code editor. You can double-click an error message to go to the line in your code where the error occurred.
C# compiler error messages are generally very clear and descriptive. If you cannot determine the problem, you can go to the Help topic for that message by pressing F1 with the error message selected in the error list. The Help topic contains additional useful information. If you still cannot solve the problem, the next step is to ask your question on one of the C# forums or newsgroups. To access the forums, click MSDN Forums on the Help menu.
Note
If you encounter a compiler error Help topic that was not helpful for your particular error, you can help Microsoft improve the documentation by sending a description of the problem. To send feedback, click the link at the bottom of the Help page that contains the error.
To execute your C# program
To build and start your program, on the Debug menu, click Start or Start Without Debugging.
-or-
Press F5.
This will create the program executable file, and then start it running.
To create a executable file that doesn't contain debug information
To create a retail version of your executable file, on the Build menu, click Build Solution.
-or-
Press CTRL+F5.
-or-
On the Debug menu, click Start Without Debugging.
See Also
Tasks
How to: Create a New Visual C# Express Application
How to: Deploy Your Visual C# Express Application