Creating a Project

As you saw earlier during the solution creation discussion, you create projects by selecting the New, Project option from the File menu. This launches the New Project dialog box (see Figure 4.11).

Image

FIGURE 4.11 Adding a project to the current solution.

Table 4.2 shows some of the various project types supported in Visual Studio out of the box.

Image
Image

TABLE 4.2 Supported Project Types


Note

Visual Studio supports the capability to create new project types and templates. Because Visual Studio is extensible in this fashion, the list of project types that you see in your particular copy of Visual Studio can vary greatly depending on the Visual Studio SKU you have installed and any add-ins, extensions, or “starter kits” you have installed on your PC.

For example, the Windows Azure software development kit (SDK), when downloaded and installed, adds project types under the Cloud category.



Note

Project types are dependent on a specific version of the .NET Framework. Changing the selected entry in the framework version drop-down that you see at the top of Figure 4.11 will filter the list of project types accordingly.


As outlined previously, creating a new project also creates a new containing solution. However, if you are creating a project and you already have a solution loaded in the IDE, the New Project dialog box offers you the opportunity to add the new project to the existing solution. Compare Figure 4.11 with Figure 4.2; notice that there is a new option in the form of a drop-down box that allows you to indicate whether Visual Studio should create a new solution or add the project to the current solution.

Website Projects

Developers have two different ways to create web projects within Visual Studio 2015. Web application projects are created using the New Project dialog that we just discussed. Website projects are created in a slightly different fashion. Instead of selecting File, New, Project, you select File, New, Web Site. This launches the New Web Site dialog box (see Figure 4.12).

Image

FIGURE 4.12 Creating a new website project.

As with other project types, you initiate website projects by selecting one of the predefined templates. In addition to the template, you select a target source language and the location for the website. The location can be the file system, an HTTP site, or an FTP site. Unlike other project types, websites are not typically created within the physical folder tree that houses your solution. By default, even selecting the file system object places the resulting source files in a Web Sites folder under the Visual Studio 2015 projects folder.


Note

The target source language for a website project simply represents the default language used for any code files. It does not constrain the languages you can use within the project. For instance, a website project created with C# as the target language can still contain Visual Basic code files.


After you have created the website, you manage and maintain it just like the other project types within the IDE.

You might be wondering about the difference between a web application project and a website project. One key difference is the way that these two different project types are built. Web application projects use the same build model as the other .NET project types; that is, all the code in the project is compiled into a single assembly. Website projects, however, support a dynamic build model in which the code for a particular page is generated at runtime the first time a user hits the page. In this model, each page has its own assembly. There are many other differences between the two project types, as discussed in Part V, “Building Web Applications.”

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset