- Installing Visual Studio
- Getting Started
- Creating Your First Project
- Navigating the IDE
- Managing the Many Windows of the IDE
- Summary
Creating Your First Project
The next, natural step is to create your first project. You might have an existing project you want to open or you might be starting fresh. In either case, creating or opening a project quickly exposes you to some of the basic project and file management features within the IDE.
To get started, you can click the File menu or the Projects link on the start page. Assuming you are using the File menu, you see the options to create a new project or website under the New submenu. Projects are simply templates that group files for Windows, Office, Web, and similar applications A website creates a set of web files that get promoted and managed as files (and not complied code).
You might have multiple projects grouped together to form a single application. In this case, each project might be grouped under a single solution. Figure 2.8 shows an example of the New Project dialog box. Notice that a Visual C#, ASP.NET Web Application is being created along with a new solution to house the project. For more information on this, see Chapter 4, "Solutions and Projects."
Figure 2.8 Creating a New Project.
Targeting Your Environment
Many of us work in environments that include applications built on various versions of the .NET Framework. You might be building your new applications on .NET 4.0, but still need to support one or more .NET 2.0 applications. Of course, this becomes even more prevalent as more versions are released. You do not, however, want to have to keep multiple versions of Visual Studio on your machine. Instead, you should be able to target the version of the Framework for which the application is written. This way you can work in a single IDE and take advantage of the latest productivity enhancements.
Visual Studio 2010 supports the ability to target a specific version of the .NET Framework for an application. This means you can use a single tool to develop against many applications built on various .NET Framework flavors. Setting the .NET Framework version of an application appropriately sets the toolbox, project types, available references, and even IntelliSense inside the IDE to be in sync with the chosen .NET Framework version. Figure 2.9 shows the New Project dialog box again; this time, the .NET Framework version selection (top-center) has been highlighted.
Figure 2.9 Creating an application to target a specific version of the .NET Framework.
After you select a Framework version, the IDE automatically adjusts the available project types, IntelliSense, reference-able libraries, and similar features. For instance, if you choose to add a reference to your project, only those libraries from the target version of the Framework are available to you in the Add Reference dialog box.
You can also decide to move your application to a different (hopefully newer) version of the .NET Framework at a later date. You can do so inside the project properties dialog box (right-click your project file inside of Solution Explorer and select Properties). Figure 2.10 shows an example. Notice the Target Framework drop-down. You can change this and the IDE then resets IntelliSense, references, your toolbox, and more to the newly selected target framework.
Figure 2.10 Resetting the target Framework of a Web application.
Of course, you can use Visual Studio 2010 to open an existing application built on a prior version of the .NET Framework. When doing so, you have the option of upgrading or keeping it tied to its current .NET Framework version. Figure 2.11 shows an example of the dialog box you see opening an older application with Visual Studio 2010. Note that you can choose to upgrade the target Framework version or continue to target an older version.
Figure 2.11 Opening an older application using Visual Studio 2010.
Many environments include developers using different versions of Visual Studio. You do have to be careful about opening these older applications inside of a newer version of Visual Studio. While the code is not affected, the actual solution file is converted to 2010 (and thus rendered useless to prior versions). If this is your environment, we recommend creating multiple versions of the solution file: one for each version of Visual Studio in use by the team.