Datasheet

14
CHAPTER 1 VISUAL STUDIO 2010
WCF This is the section where you can create Windows Communication Foundation projects.
Workfl ow This is the section where you can create Windows Workfl ow Foundation (WF) projects.
The templates in this section also include templates for connecting with the SharePoint workfl ow engine.
Visual Studio has other categories for projects, and you have access to other development languages and far
more project types than this chapter has room for. When looking to create an application you will choose
from one or more of the available project templates. To use more than a single project to create an application
you ll leverage what is known as a solution. A solution is created by default whenever you create a new
project and contains one or more projects.
When you save your project you will typically create a folder for the solution, then later if you add another
project to the same solution, it will be contained in the solution folder. A project is always part of a solution, and
a solution can contain multiple projects, each of which creates a different assembly. Typically for example you will
have one or more Class Libraries that are part of the same solution as your Windows Form or ASP.NET project.
For now, you can select a Windows Application project template to use as an example project for this chapter.
For this example, use ProVB_VS2010 as the project name to match the name of the project in the sample code
download and then click OK. Visual Studio takes over and uses the Windows Application template to create a
new Windows Forms project. The project contains a blank form that can be customized, and a variety of other
elements that you can explore. Before customizing any code, let s fi rst look at the elements of this new project.
The Solution Explorer
The Solution Explorer is a window that is by default located on the right - hand side of your display when
you create a project. It is there to display the contents of your solution and includes the actual source fi le(s)
for each of the projects in your solution. While the Solution Explorer window is available and applicable for
Express Edition users, it will never contain more than a single project. Those with a version of Visual Studio
above the Express Edition level have the capability to leverage multiple projects in a single solution. A .NET
solution can contain projects of any .NET language and can include the database, testing, and installation
projects as part of the overall solution. The advantage of combining these projects is that it is easier to
debug projects that reside in a common solution.
Before discussing these fi les in depth, let s take a look at the next step, which
is to reveal a few additional details about your project. Click the second
button on the left in the Solution Explorer to display all of the project fi les,
as shown in Figure 1 - 4. As this image shows, many other fi les make up your
project. Some of these, such as those under the My Project grouping, don t
require you to edit them directly. Instead, you can double - click the My Project
entry in the Solution Explorer and open the pages to edit your project settings.
You do not need to change any of the default settings for this project, but the
next section of this chapter walks you through the various property screens.
The bin and obj directories shown are used when building your project. The obj
directory contains the fi rst - pass object fi les used by the compiler to create your
nal executable fi le. The binary or compiled version of your application is
then placed in the bin directory by default. Of course, referring to the Microsoft
intermediate language (MSIL) code as binary is something of a misnomer, as the
actual translation to binary does not occur until runtime when your application
is compiled by the just - in - time (JIT) compiler. However, Microsoft continues to
use the bin directory as the default output directory for your project s compilation.
Figure 1 - 4 also shows that the project does not contain an
app.config le by default. Most experienced ASP
.NET developers are familiar with using web.config les. app.config les work on the same principle in
that they contain XML, which is used to store project - specifi c settings such as database connection strings and
other application - specifi c settings. Using a .config le instead of having your settings in the Windows registry
enables your applications to run side - by - side with another version of the application without the settings from
either version affecting the other. Because each version of your application resides in its own directory, its
FIGURE 1 - 4
CH001.indd 14CH001.indd 14 4/5/10 11:56:27 AM4/5/10 11:56:27 AM