Compiling and Running a Project

This section provides a tutorial example on how to compile and run a Visual C# 2010 project. Visual Studio 2010 generates 64-bit and 32-bit executable files.

After creating a Visual C# 2010 project as described in the previous section, I am ready to compile and run it.

1. Run Visual C# 2010 Express.

2. To open the solution project saved in the previous section, select "Open Project" from the "File" menu. The "Open Project" dialog box comes up.

3. Select C:\herong\ConsoleApplication1\ConsoleApplication1.sln and click the "Open" button. The example application source code, Program.cs, opens up.

4. To compile the example application, select "Build Solution" from the "Debug" menu. You should see the "Build succeeded" message at button left corner of the Visual Studio window.

5. Open folder C:\herong\ConsoleApplication1 with Windows Explorer, you should see:

C:\herong\ConsoleApplication1

   ConsoleApplication1.sln
D> ConsoleApplication1
      ConsoleApplication1.csproj
      ConsoleApplication1.csproj.user
   D> bin
      D> Debug
            ConsoleApplication1.vshost.exe
            ConsoleApplication1.vshost.exe.manifest
      D> Release
            ConsoleApplication1.exe
            ConsoleApplication1.pdb
   D> obj
      D> x86
         D> Debug
               DesignTimeResolveAssemblyReferencesInput.cache
            D> TempPE
         D> Release
               ConsoleApplication1.csproj.FileListAbsolute.txt
               ConsoleApplication1.exe
               ConsoleApplication1.pdb
               DesignTimeResolveAssemblyReferencesInput.cache
               ResolveAssemblyReference.cache
            D> TempPE
   D> Properties
         AssemblyInfo.cs

We have 3 executable versions of the application generated from the compiler: 64-bit debug version, 64-bit release version, and 32-bit release version.

Run the 64-bit release version in a command line window, you will get:

C:\herong>cd ConsoleApplication1\ConsoleApplication1\bin\Release

C:\herong\ConsoleApplication1\ConsoleApplication1\bin\Release>
   ConsoleApplication1.exe

Hello world!

Table of Contents

 About This Book

 Introduction of C# (C Sharp)

 Data Type and Variables

 Logical Expressions and Conditional Statements

 Arrays and Loop Statements

 Data Type Features

 Floating-Point Data Types

 Passing Parameters to Methods

 Execution Environment Class

Visual C# 2010 Express Edition

 Downloading and Installing Visual C# 2010 Express

 Creating a Visual C# 2010 Project

Compiling and Running a Project

 Class Features

 C# Compiler and Intermediate Language

 Compiling C# Source Code Files

 MSBuild - Microsoft Build Engine

 Memory Usages of Processes

 Multithreading in C#

 Async Feature from C# 5

 System.IO.FileInfo Class

 System.Diagnostics.FileVersionInfo Class

 WPF - Windows Presentation Foundation

 Partial Classes and Partial Methods

 Archived Tutorials

 References

 Full Version in PDF/ePUB