Friday, February 21, 2014

Visual Studio 2010 - Part 3

Project Directory Structure

     When we create a new project, some directory structure will be created automatically by following the below specified rules. 
  • Each solution will be created as a folder.
  • Each project will be created as a folder, and placed in the solution folder.
  • All the files related to the project, will be placed in the project folder.
  • The  information  about  the  solution  members  will  be  saved  in  a  file  called  Solution  file  and  it  will  be  placed  in  the solution  folder.  When  we  double  click on  it,  that  solution  will  be  opened  in  Visual  Studio.  The  file  extension  of  the solution file is .sln.
  • In the same way, the information about the project members will be saved in the  Project file and it will be placed in the project folder. When we double click on it, that project will be opened in Visual Studio.
You can observe the project directory structure according to our previous example.
Note:  First,  recollect  the  project  name,  project  location  and  solution  name  from  previous example.
 

  • bin: This folder contains the EXE file after compiling the project.
  • obj: This folder contains the temporary files of the project, while compilation.
  • Properties:  This  folder  contains  necessary  files  that  contain  information  about  the settings and resources related to the project.
  • WindowsFormsApplication1.csproj (Project File): This  file  contains the information about all the files related to the project; When you double click on it, the project will be opened in Visual Studio.
  • Form1.cs: This file contains the executable code of Form1.
  • Form1.Designer.cs: This file contains the code related to the design of Form1.
  • Program.cs: This file contains the code of Program‖ class with Main() method.

Components of Visual Studio IDE


  1. Menu  Bar:  This  bar  contains  the  available  menus  in  Visual  Studio  like  -> File,  -> Edit, -> View and -> Project etc.
  2. Tool Bars:  There  are  several  toolbars  in  Visual  Studio,  which  contain  frequently  used options in Visual Studio.
  3. Tabs: Displays tabs; just click to open required tab.
  4. Form designer: Used to view and edit the visual design of the form.
  5. Code  Window:  This  is  where  you  write  actual  programming  of  your  application.  You can switch to this view, by right click on the form designer and choosing View Code (or) by pressing F7 key on the keyboard.

   6.  Solution Explorer: Explores the information about the solution and its members.
   7.  Properties:  Displays  the  available  properties  and  values  for  the  selected  solution, project, form            or control; and also allows changing the property values.
   8.  Other:  In addition to the above  specified IDE components, some other components are also available         docked  at  the  bottom  area  of  Visual  Studio  window  like  Output,  Error List, Command                       window, Immediate window, Breakpoints. We discuss about these components whenever required, in           upcoming chapters later.

Creating Console Applications

The  console  applications  are  the  project  types,  recommended  for  the  .NET  programming beginners, where you can learn the language features better.

  • In Microsoft Visual Studio 2010, click on File –> New –> Project.
  • Select  the  language  as  Visual  C#  and  select  the  project  template  as
    Console Application.

  • Then enter the project name and location (with your choice) and click on OK