Deploying DLL file into SharePoint bin folder
After you have built the project successfully, all you need
is to get the DLL file from the bin folder of your project. We are going to
deploy that DLL file into the SharePoint site; you can do that simply by
copying that DLL and pasting it into the bin folder of the SharePoint site. Or
you can change the build output path of the webpart project into the bin folder
of the SharePoint site so that it will deploy the DLL file automatically after
any build operation.
To change the build output path, use the following steps:
1. From the Solution Explorer,
right click over the Solution name, and click on Properties.
2. New window will be opened, click on Compile
tab, and then click on browse button in the
Build output path.
3. Find out the bin folder of your SharePoint site, and then
set it as "Build output path" for the webpart project.
Now if you rebuild the project again, it will deploy the
project DLL file into the bin folder of the SharePoint site.
Adding SafeControl to the SharePoint Web.Config file
The second step in deploying webpart project into SharePoint
site is to add the SafeControl of our webpart project into the SharePoint
web.config file.
So you have to navigate to the following path:
C:\InetPub\wwwroot
And open your SharePoint Site folder, then you will find a
web.config file in the root of the SharePoint site. Open it and add a new
SafeControl element as shown in Listing 2.
Listing 2
<SafeControl Assembly="TestAbdelHaqWebPart"
Namespace=" TestAbdelHaqWebPart" TypeName="*" />
That is it; you have deployed a webpart project into a SharePoint
site.