Wednesday, February 01, 2006

 

How to manually install a SharePoint web part when you have only the DLL and DWP files

When I posted my Gantt chart web part, some people asked for more guidance on how to deploy web parts that don't come with an installer. In my opinion, a professional web part should come with an installer, but sometimes people post samples or demos and don't have the time (or motivation) to build an installer for you and you are stuck with a DLL file and a DWP file. This post describes how you get it to work.

Prerequisites

Placing the files in the right folders

You will have downloaded a ZIP file containing at the very least a DLL file and a DWP file. These two files are the bare necessities for installing your web part. In a default WSS installation, you will have a folder C:\Inetpub\wwwroot\wpcatalog. Place the DWP file in this folder. Place the accompanying DLL file in the C:\Inetpub\wwwroot\bin folder.

The new web part will now appear in the catalog when you browse for new web parts, but you have to change some settings before you actually use it.

Trusting the part

By default, SharePoint will distrust all DLLs that are placed in its folders. We have to tell SharePoint that our specific web part can be trusted. To achieve this, you open the web.config file in the C:\Inetpub\wwwroot folder. This is an XML file and you must be very careful editing it: when your edit results in invalid XML, the whole WSS system will stop working (if you have no idea what invalid XML is, this post is not for you). Also: every time you save the web.config file, the web server will restart itself (the AppDomain, really). Don't do this casually on a production system. Remember to make a backup of the old web.config. In the XML file, you will find a section <safecontrols> that contains a list of trustworthy web parts. Normally, the web part author will provide you with a snippet that should be added to the list.

Once the web.config is updated, your web part should be ready to roll. Some web parts may need additional steps, but these will then be described in detail by the part's author.

Labels:


Comments:
Would it even be possible to just package the files in a cab, or better yet, a msi. Your instructions don't seem to cover installation on a portal server. They appear to need a different installation using stsadm.exe to properly install the files. The assembly should also have a manifest.xml for stsadm.exe to read. My 3 cents.
 
Do you have a Gantt Chart web part for WSS 3.0 or will these files work with WSS 3.0?
 
Teun, thanks for the work. It looks like exactly what our team needs. I'm a newbie so forgive me if I'm asking a stupid question. I'm not the Server Admin only the admin for our site. Is it still possible to load and use the webpart you created? I'm using 2007 Sharepoint. I can load the ".dwp" file into the Web Part Galleries and it will show up on the list when adding a web part but I get a "Unable to import Web Part" error message when I try to add it to the web part page.
 
@patrick:
I'm sorry, but you really need access to the server as an admin. The feature contains executable code and must be installed on the server.
 
Post a Comment

Links to this post:

Create a Link



<< Home

This page is powered by Blogger. Isn't yours?