The difference between .dwp and .webpart

Posted Thursday, August 21, 2008 4:50 PM by CoreyRoth

I have been doing some quite a bit of mentoring to new SharePoint developers lately and was asked the question of what the difference was between a .dwp and .webpart file and which one should be used.  Yes, I know this is an intro topic but if you are new to SharePoint you aren't going to know this.  As you may know, they are both files used for describing where the code is for a web part.  The difference is .dwp was the file extension used in version 2 of SharePoint and .webpart is a new extension used in version 3.  Inside the files, the schemas are different and it is indicated as such by the version number on the xmlns attribute.

Here is an example of a version 2 schema.

<WebPart xmlns="http://schemas.microsoft.com/WebPart/v2">

  <Assembly>Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>

  <TypeName>Microsoft.SharePoint.Portal.WebControls.SearchBoxEx</TypeName>

  <Title>Search Box</Title>

  <Description>Used to search document and items.</Description>

  <FrameType>None</FrameType>

  <AllowMinimize>true</AllowMinimize>

  <AllowRemove>true</AllowRemove>

  <IsVisible>true</IsVisible>

  <Width>335px</Width>

  <GoImageUrl xmlns="urn:schemas-microsoft-com:SearchBoxEx">/_layouts/images/gosearch.gif</GoImageUrl>

  <GoImageUrlRTL  xmlns="urn:schemas-microsoft-com:SearchBoxEx">/_layouts/images/goRTL.gif</GoImageUrlRTL>

  <GoImageActiveUrl xmlns="urn:schemas-microsoft-com:SearchBoxEx">/_layouts/images/gosearch.gif</GoImageActiveUrl>

  <GoImageActiveUrlRTL  xmlns="urn:schemas-microsoft-com:SearchBoxEx">/_layouts/images/goRTL.gif</GoImageActiveUrlRTL>

</WebPart>

Version 3 is a little different.

<webParts>

  <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">

    <metaData>

      <type name="Microsoft.SharePoint.Portal.WebControls.BusinessDataListWebPart, Microsoft.SharePoint.Portal,Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" />

      <importErrorMessage>Cannot import this web part.</importErrorMessage>

    </metaData>

    <data>

      <properties>

        <property name="Title" type="string">Business Data List</property>

        <property name="Description" type="string">Display a list of items from a data source in the Business Data Catalog.</property>

        <property name="CatalogIconImageUrl" type="string">/_layouts/images/bizdatawebpart.gif</property>

        <property name="CacheXslStorage" type="bool">true</property>

        <property name="CacheXslTimeOut" type="int">600</property>

      </properties>

    </data>

  </webPart>

</webParts>

The main difference is that all properties passed to the web part are specified with a property element and a name attribute in version 3.  Version 2 uses different element names for everything. 

Which file extension should you be using?  Probably .webpart since it is version 3.  However, there is really nothing wrong with using version 2 although maybe it will be removed from a future version of SharePoint.  If you take a look at the web part gallery, you will see plenty of web parts still using .dwp.  So for now, I recommend version .webpart, but if you are more familiar with the syntax of version .dwp, have at it.

Filed under:

Comments

# My favorite links from the 4th week of August 2008

Sunday, August 24, 2008 6:48 AM by YESChandana -Blog

My favorite links from the 4th week of August 2008

# Provision a WebPart using a SharePoint Feature. &laquo; More Soma Please&#8230;

Pingback from  Provision a WebPart using a SharePoint Feature. &laquo; More Soma Please&#8230;

# re: The difference between .dwp and .webpart

Tuesday, February 16, 2010 10:11 PM by Preet

Hi,

I don't know your (Author's) name. But whomsoever you are. You had done amazing job. I am .Net Developer and using sharepoint since while but your articles are so nicely written that any new developer will find it very comfortable. Once again hats off to you and thanks for writting such wonderful articles. Keep up the good work.

Thanks,

Preet

# re: The difference between .dwp and .webpart

Wednesday, February 24, 2010 3:44 AM by Himani

Thanks. This is the information I was searching for. I ahvea n additional out of place query though. The .dwp or .webpart files that are provisioned using a WSP, go to which location within the filesystem?

# re: The difference between .dwp and .webpart

Wednesday, February 24, 2010 8:54 AM by CoreyRoth

They go into the web part gallery inside SharePoint.  You won't actually find them on the file system anywhere.

# re: The difference between .dwp and .webpart

Monday, March 8, 2010 11:38 AM by Dean

I put a ContentEditor web part on a page. Added text for a disclaimer statement. I exported the web part as disclaimer.dwp. I imported it into the web part gallery and added it to a page. Worked great. Now I want to add it to a site definition. Nothing I try works. HELP!!

# re: The difference between .dwp and .webpart

Monday, March 8, 2010 11:43 AM by CoreyRoth

If you want to add it to a site definition, I recommend putting it in a feature and then use feature stapling to attach that feature to your site definition.

# re: The difference between .dwp and .webpart

Friday, April 30, 2010 12:32 AM by sivareddy

The differance here is that one is a SharePoint webpart and the other is a .NET web part.

The .dwp is a SharePoint web part.  This would be one like the Content Editor.

The .webpart is a .NET framework.

The primary differances are that the SharePoint webparts are built with backwards compatibility and more functionality in the web parts communitcation area.  If you needed a web part that worked in WSS 2.0 and WSS 3.0, this would be your guy.

The later is one that most likely originated in Visual Studio.

# Extend the Search Box web part in SharePoint 2010

Monday, June 28, 2010 10:26 AM by Steven Nicolaou

Introduction With SharePoint 2010 you can now extend the out of the box web parts, which essentially

# re: The difference between .dwp and .webpart

Monday, January 10, 2011 11:27 PM by vishal wattamwar INDAL

Thanks

This is the information I was searching.

# re: The difference between .dwp and .webpart

Wednesday, March 9, 2011 4:35 PM by Chris

Great writeup.  Do you know if you can access other .NET assemblies through this .webpart?  For example, setting the type to:

System.Web.UI.WebControls,System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

And accessing something from there?

# re: The difference between .dwp and .webpart

Monday, February 20, 2012 1:00 PM by Ravindran Mani

.dwp and .webpart both are web part and drived from .asp.net  webpart. . Both supports for SharePoint Deployment. .dwp won't support for  ASP.net deployment.

.dwp process xml Serialization also. if  we need to deploy assemblies on LAC instead of GAC. the webpart needs to be on .dwp mode

# Web Part &icirc;n SP 2007 | Just do IT

Thursday, June 7, 2012 12:15 AM by Web Part în SP 2007 | Just do IT

Pingback from  Web Part &icirc;n SP 2007 | Just do IT

# re: The difference between .dwp and .webpart

Thursday, July 5, 2012 3:59 AM by jagadeesh

Great post...

# re: The difference between .dwp and .webpart

Tuesday, April 22, 2014 9:36 AM by Peyton King

So I believe that a .DWP file can go from writer to screen by user action alone, whereas a .net originating web part cannot be deployed to a page without being pre-staged by someone in IT which makes DWPs much more accessible to the typical power user who has no .Net experience and no access to deploy it to the server... this would beg the question as to if .webpart inidcates a .net webpart as opposed to a non .net webpart?

As far as versions, it appears that .DWP is alive in 2013, just harder to build as SharePoint is pulled away from PowerUsers using client development tools like the Content Editor Web Part. The good news is that much more of SharePoint is accessible to Javascript now than used to be.

# Extend the Search Box web part in SharePoint 2010 | Steven Nicolaou

Pingback from  Extend the Search Box web part in SharePoint 2010 | Steven Nicolaou

Leave a Comment

(required)
(required)
(optional)
(required)