Before you can start writing code for a web part, you need to set a few things up so that you can debug and test the component from within SharePoint:
Create a test page in SharePoint.
Create and configure a new project.
Build and sign the assembly; then extract the token.
Register the web part Web.config.
Add the web part to the test page to verify that everything works.
The following sections describe these tasks in more detail.
Since web part projects are class libraries, they require a context within which to run. It is a good idea to create a document library of web part pages on your development server for debugging and/or testing purposes. Using a document library helps organize the test pages and makes it easier to create/modify them.
To create a test web part page library:
From SharePoint on the development server, choose Create → Document Library. SharePoint displays the New Document Library page.
Enter the name TestPages, select the Web Part Page document template, and choose Create. SharePoint creates a new document library.
Choose New Document to create a new, empty web part page named
Write down the address of the new page. You'll use that address when configuring the project.
To create and configure a new web part project in Visual Studio:
From Visual Studio, choose File → New Project, select the Web Part Library template from the Visual Basic .NET or Visual C# project type, and choose OK. Visual Studio ...