With the release of Microsoft Visual Studio 2008 many SharePoint Developers will be interested in creating custom Web Parts for SharePoint. This is entirely achievable and not very different from how it is done within Visual Studio 2005.
While the avenues to accomplishing this are similar with Microsoft Visual Studio 2005, there are a few items to consider:
- Visual Studio 2005 Extensions for Windows SharePoint Services is not available or compatible with Microsoft Visual Studio 2008
- As a good practice, it is recommended to backup your project before converting it into Visual Studio 2008
Creating the Web Part Project can be done in two of ways:
- Convert an existing template project from Microsoft Visual Studio 2005
- Create the project from scratch
- Add the following references to the project:
- Add the following code to the top of the project
- Assign the class to inherit from the WebPart
- Add the RenderWebPart code:
void RenderWebPart(HtmlTextWriter output)
- Add desired code inside the "RenderWebPart"
- Determine deployment type: bin or Global Assembly Cache
- By default the Target Framework is 3.5
- Deploy the Custom Web Part