in

Dot Net Mafia

Group site for developer blogs dealing with (usually) .NET, SharePoint 2013, SharePoint 2010, Office 365, SharePoint Online, and other Microsoft products, as well as some discussion of general programming related concepts.

This Blog

Syndication

Archives

Corey Roth [MVP]

A SharePoint MVP bringing you the latest time saving tips for SharePoint 2013, Office 365 / SharePoint Online and Visual Studio 2013.

The difference between .dwp and .webpart

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.

Published Aug 21 2008, 04:50 PM by CoreyRoth
Filed under:

Comments

 

YESChandana -Blog said:

My favorite links from the 4th week of August 2008

August 24, 2008 6:48 AM
 

Provision a WebPart using a SharePoint Feature. « More Soma Please… said:

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

August 4, 2009 5:04 AM
 

Preet said:

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

February 16, 2010 10:11 PM
 

Himani said:

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?

February 24, 2010 3:44 AM
 

CoreyRoth said:

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

February 24, 2010 8:54 AM
 

Dean said:

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!!

March 8, 2010 11:38 AM
 

CoreyRoth said:

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.

March 8, 2010 11:43 AM
 

sivareddy said:

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.

April 30, 2010 12:32 AM
 

Steven Nicolaou said:

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

June 28, 2010 10:26 AM
 

vishal wattamwar INDAL said:

Thanks

This is the information I was searching.

January 10, 2011 11:27 PM
 

Chris said:

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?

March 9, 2011 4:35 PM
 

Ravindran Mani said:

.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

February 20, 2012 1:00 PM
 

Web Part în SP 2007 | Just do IT said:

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

June 7, 2012 12:15 AM
 

jagadeesh said:

Great post...

July 5, 2012 3:59 AM
 

Peyton King said:

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.

April 22, 2014 9:36 AM
 

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

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

March 16, 2016 9:21 PM

Leave a Comment

(required)  
(optional)
(required)  
Add

About CoreyRoth

Corey Roth is an independent SharePoint consultant specializing in ECM, Apps, and Search.
2015 dotnetmafia.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems