Building Site Definitions with Visual Studio 2005 Extensions for Windows SharePoint Services 3.0 and SharePoint Designer 2007

Summary:  Learn how to build a site definition for Windows SharePoint Services 3.0 by using the SharePoint Solution Generator.

Applies to:  2007 Microsoft Office System, Windows SharePoint Services 3.0, Microsoft Visual Studio 2005 Extensions for Windows SharePoint Services 3.0, Microsoft Office SharePoint Designer 2007

Joel Krist, iSoftStone

January 2008

Microsoft Visual Studio 2005 Extensions for Windows SharePoint Services 3.0 provides new support to ease the process of creating SharePoint site definitions. The SharePoint Solution Generator has the ability to create a Visual Studio site definition project from an existing SharePoint site, allowing the developer to create a site definition from an already customized site. This Visual How To illustrates how to build a Windows SharePoint Services 3.0 site definition by using Microsoft Visual Studio 2005 with Extensions for Windows SharePoint Services 3.0, SharePoint Solution Generator, and Microsoft Office SharePoint Designer 2007.

To illustrate how to build SharePoint site definitions, this section walks through four key steps:

  1. Modifying an existing site by using SharePoint Designer 2007.

  2. Creating a Visual Studio Site Definition project from the site in SharePoint Solution Generator.

  3. Modifying and deploying the Site Definition project in Visual Studio.

  4. Creating a new site by using the new site definition in Microsoft SharePoint Designer 2007.

Modifying an Existing Site in SharePoint Designer 2007

The first step is to open the SharePoint site. Do the following:

  1. Start Office SharePoint Designer 2007.

  2. On the File menu, click Open Site. The Open Site dialog box appears.

  3. Type the URL of the SharePoint site and click Open. SharePoint Designer displays the contents of the site.

When the site is open in SharePoint Designer, modify the site and save the changes.

Creating a Visual Studio Site Definition Project in SharePoint Solution Generator

To create a Visual Studio Site Definition project in SharePoint Solution Generator, do the following:

  1. Start SharePoint Solution Generator. The initial SharePoint Solution Generator window is displayed.

    Figure 1. SharePoint Solution Generator


  2. Select Site Definition, and then click Next. The Generate Site Definition window is displayed with options for specifying the site on which to base the site definition.

    Figure 2. Choosing a site instance


  3. Choose or specify the site from which create the site definition template, and then click Next. Options for specifying the name and location of the Visual Studio project are displayed.

    Figure 3. Choosing a project name and location


  4. Specify a name and location for the project, and click Next. SharePoint Solution Generator displays the list of tasks it will complete when generating the project.

    Figure 4. Finalizing settings


  5. Select the Finish button and Solution Generator steps through each task, creating the new Visual Studio site definition project.

    Figure 5. Generating the Solution


Modifying and Deploying the Site Definition Project in Visual Studio

After SharePoint Solution Generator generates the Visual Studio project, the project can be opened in Visual Studio, modified, and then deployed. Open the project in Visual Studio by doing the following:

  1. Click the Click here to open the generated solution link in the final SharePoint Solution Generator window. Windows Explorer displays the folder containing the generated Visual Studio project.

    Figure 6. The generated solution folder


  2. Double-click the .csproj file to open the project in Visual Studio.

Customizing the Site Definition by Modifying the Existing Content or Adding New Features

After you customize of the site definition, you can deploy it. To deploy the site definition, do the following:

  1. In the Visual Studio Solution Explorer, right-click the name of the site definition project and click Deploy. Visual Studio displays the Save As dialog box, prompting for the name to use for the Solution File.

    Figure 7. Saving the solution file


  2. Specify a name for the solution file. and then click Save. Visual Studio builds any assemblies and generates the necessary configuration files for deployment of the solution. It then deploys the site definition to Windows SharePoint Services.

    Figure 8. Building and deploying the solution


Creating a New Site by Using the New Site Definition in Microsoft SharePoint Designer 2007

Now that the new site definition is deployed to Windows SharePoint Services, a new site instance can be created from it. To use SharePoint Designer 2007 to create a new site based on the site definition, do the following:

  1. Start SharePoint Designer 2007.

  2. On the File menu, point to New, and then click Web Site. The New dialog box appears.

  3. On the Web Site tab, specify the location of the new Web site off the SharePoint site to which the new site definition was deployed, and then select the SharePoint Templates category. SharePoint Designer displays the site definitions currently installed on the server.

    Figure 9. Creating a new Web site


  4. Select the new site definition and then click the OK button. SharePoint Designer creates the new site based on the new site definition.

This article illustrated how to build Windows SharePoint Services 3.0 site definitions by using SharePoint Designer 2007, SharePoint Solution Generator, and Microsoft Visual Studio 2005 with Extensions for Windows SharePoint Services 3.0. The key steps include:

  1. Modifying an existing site by using SharePoint Designer 2007.

  2. Creating a Visual Studio Site Definition project from the site in SharePoint Solution Generator.

  3. Modifying and deploying the Site Definition project in Visual Studio.

  4. Creating a new site by using the new site definition in Microsoft SharePoint Designer 2007.

Watch the Video

Length: 6:47 | Size: 5.8 MB | Type: WMV