Opening a Project in the IDE

 

More Detail on the Project Files

To discuss these files, we will assume that the Create directory for solution option was chosen (check box checked), which places these files into three different directory levels.

These are the important files in an MSBuild project folder (for demonstration purposes, we will name our project HokeyPokey):

Level One : Project name, HokeyPokey. In earlier versions of Visual Studio C# the name of the project could not contain blank spaces. This has been corrected in version 2.0. For example, in this case, after you name the project Hokey Pokey, the project files carry the namespace as Hokey_Pokey.

Level Two : There is one subdirectory, which has the same name as the project (HokeyPokey), and one individual file named HokeyPokey.sln. The *.sln file is a solution file and contains the name of the project and information about the form of the debug and release versions of the project executable. This file also sets some internal switches in the compiler. To bring a project into the IDE, it is necessary to double-click on the *.sln file. Then the *.sln file calls the *.csproj file, which is located in the adjacent HokeyPokey subdirectory. HokeyPokey.csproj is the entry into the main project.

Level Three : These are the subdirectories and files contained in the HokeyPokey directory, which is a subdirectory of HokeyPokey.

This level has three subdirectories: bin, obj, and properties. It also includes five individual files: HokeyPokey.csproj, HokeyPokey.csproj.user, Form1.cs, Form1.Designer.cs, and Program.cs. The HokeyPokey.csproj and HokeyPokey.csproj. user files are the link between the IDE and the project. They are computer-generated files that are never modified by the programmer.

As has been the custom for many years , the Form1.cs file is the source code file. Form1.Designer.cs holds the descriptors for the controls placed on the form, which is the representation of one Microsoft window. The Program.cs file is part of the entry point for the project and should never be modified. Leave it alone.

If you want to view any of these files, just open them in WordPad. They are text files. One of the stated goals of MSBuild was to place the important project files in the project in text format (as opposed to machine code format) for ease of reading by the programmer.

In summary, everything that the programmer does in the IDE is reflected in the Form1.cs or Form1.Designer.cs files. The programmer types some of the entries into the source code file, Form1.cs, while other entries are computer-generated. The IDE places all code in the Form1.Designer.cs file (window template) to describe the items the programmer has placed onto the basic Microsoft window template (labels, buttons , text boxes, etc.).

The obj and properties subdirectories are used only by the compiler ” the programmer makes no entries in any of the files here. But the bin subdirectory contains all the executable forms of the project, including HokeyPokey.exe, HokeyPokey.pdb, and HokeyPokey.vshost.exe. The only executable you will use at this time is HokeyPokey.exe.

IMPORTANT  

If your project reads any programmer-created text files during its execution, you have two choices in the pathing of the files (so your project can find the file to be read). The first method is to include the entire absolute path in the name of the file and place the file anywhere you want on your computer. Absolute pathing always begins with C:\. The second method is to place the file to be read in the same subdirectory as the executable file. During preliminary work on a project, it may be easier to place a file that is to be read into the project in the same subdirectory as the executable, and then convert to absolute pathing just before code release. In this case, the directory in which the executables are found is HokeyPokey\HokeyPokey\ bin\debug.

Examples of absolute pathing are shown in the KT series of projects installed from the companion files, where the data files are all located in a C:\Program Files\KT folder.

 


Unlocking Microsoft C# V 2.0 Programming Secrets
Unlocking Microsoft C# V 2.0 Programming Secrets (Wordware Applications Library)
ISBN: 1556220979
EAN: 2147483647
Year: 2005
Pages: 129

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net