Developing Project Server Web Parts
Updated: September 2010
Web Parts for Microsoft Project Server 2010 can be built on the ASP.NET infrastructure in System.Web.UI.WebControls.WebParts or on the Microsoft SharePoint 2010 implementation in Microsoft.SharePoint.WebControls, which in turn derives from the ASP.NET classes. Unless you require specific features of the SharePoint implementation, such as cross-page connections, built-in caching, or client-side connections, we recommend that you directly derive Web Parts for Project Server from the ASP.NET classes.
With the SharePoint Developer Tools in Microsoft Visual Studio 2010, it is easier to create Web Parts than in previous versions of Visual Studio. When you add a Web Part to a SharePoint project, the Visual Web Part item template enables additional features. For example, you can use both the code view and the design view of a Visual Web Part control. For configuration, you can also create simple Web Part properties that automatically show in the default EditorPart control, which enables users to personalize a Web Part in the user view or in the shared view. Visual Web Parts derive from the ASP.NET System.Web.UI.WebControls.WebParts.WebPart class. If you use the Web Part item template, the design view and simple default properties are not readily available. In either case, you can create custom editor parts that incorporate complex controls, enable editing of different property types, and use custom validation routines.
When you create a Visual Studio project for a Project Server Web Part, start with the Empty SharePoint Project template. Using this template, you can specify the name, for example ProjectServerParts.PDP; this name becomes the project name, the namespace, and the assembly name. You can then add one or more Visual Web Part items with different names to the project. After you create the project and add a Visual Web Part, changing the names can introduce errors unless you carefully fix the names in all of the Elements.xml files and in the SharePoint Feature files and Package files. Because SharePoint Server 2010 and Project Server 2010 are built on Microsoft .NET Framework 3.5, ensure that the target framework for your project is the .NET Framework 3.5. In the SharePoint Customization Wizard, select the Deploy as a farm solution option.
For detailed information about Web Parts, see ASP.NET Web Parts Controls and Web Parts in SharePoint Foundation. For more information about personalizing Web Parts and creating custom editor parts, see Personalizing Using Web Parts, User Interface Customization Resource Center | SharePoint 2010, and the blog post How do I create Visual Web Parts in SharePoint Foundation 2010 with Visual Studio 2010. For several examples that include complete source code for Web Parts with custom editor parts, see Microsoft Project 2010 Solution Starters.