How to: Perform ASP.NET-Related Development with Visual Studio extensions for Windows SharePoint Services

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Using Visual Studio extensions for Windows SharePoint Services (also referred to as "extensions" in this topic) simplifies SharePoint deployment. Two components that many SharePoint solutions deploy are custom ASPX pages and custom ASCX controls. The extensions' project templates do not provide the same support for developing these components that a Web Application project template does. This topic demonstrates how custom ASPX pages and custom ASCX controls can be developed in a Web Application project and then deployed using an extensions project.

To develop custom ASP.NET-related files with Visual Studio extensions for Windows SharePoint Services

  1. In Visual Studio, create a new solution with one of the Visual Studio extensions for Windows SharePoint Services project templates.
  2. In the new solution, create a new project with the ASP.NET Web Application project template. In this new project, delete the Default.aspx file, the App_Data folder, and the Web.config file.
  3. Add a new ASPX or ASCX project item to the Web Application project.
  4. Add the new file to the Visual Studio extensions for Windows SharePoint Services project as a link to the existing item. To link a file from another project, right-click the folder, click Add Existing Item, navigate to the file, and then click Add As Link in the Add drop down list. Do the following:
    1. For an ASPX file, create a new Module project item and place the linked ASPX file in the new module. Edit the Module.xml file to include a File element. Update the Path and Url attributes to the file name of the .aspx file. This deploys the page when the SharePoint solution is deployed.
    2. For an ASCX file, create a new Template project item, add a folder named ControlTemplates, add a subfolder so you can distinguish just your files when they are installed in SharePoint and add the linked .ascx file to that subfolder.
  5. Add ASP.NET-related assembly references to the Visual Studio extensions for Windows SharePoint Services project. This allows the code behind to compile.
  6. In the Configuration Manager of the solution, clear the Build for the Web Application project check box.
  7. Open the linked code-behind file from the Visual Studio extensions for Windows SharePoint Services project and change the namespace to match the namespace of the project.

Open the markup of the file from the Web Application project, remove the CodeBehind attribute from the markup, and then edit the Inherits attribute to match the assembly information for the Visual Studio extensions for Windows SharePoint Services project.

After you configure the solution items, use the following two methods to edit the files' markup and code behind:

  • To edit the markup of the ASP.NET-related files, use the Web Application project to open the markup file. This allows you to take advantage of the automatic generation of the designer's code-behind file.
  • To edit the code behind of the ASP.NET-related files, use the Visual Studio extensions for Windows SharePoint Services project to open the code-behind file. This allows you to use IntelliSense for any code references that you have in these files.

After you build the extensions project, follow the extensions' deployment process to package the solution and deploy it to SharePoint. To learn more about how to use the extensions, download Windows SharePoint Services 3.0 Tools: Visual Studio 2005 Extensions User Guide, Version 1.1.

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Footer image

To provide feedback, get assistance, or download additional, please visit the SharePoint Guidance Community Web site.

Copyright © 2008 by Microsoft Corporation. All rights reserved.