Ravendra's Blog

Creating WSP package from .net Assembly


Creating your own WSP package from a .net Assembly

Let’s say you want to create a WSP package for a web part class library. For some reason you are not able to use standard tools to create WSP for you (i.e. stsdev etc).

  1. Create web part class library

Use sharepoint web part project type to create a new project.

  1. Add as many web parts you need to add

Please not that for each web part added you need to make a entry in following files

    1. .ddf
    2. manifest.xml
    3. feature.xml
    4. webparts.xml

In a moment I will come into details of these file types.

  1. .ddf file

; Generated at 30/11/2009 10:10:50

.OPTION EXPLICIT

.Set CabinetNameTemplate=ReportingWebParts.wsp

.set DiskDirectoryTemplate=CDROM

.Set CompressionType=MSZIP

.Set UniqueFiles=off

.Set Cabinet=on

.Set DiskDirectory1=”bin\Debug\”

;*** Solution manifest

bin\Debug\manifest.xml

;*** Assembly files

“bin\Debug\BusinessLogicLayer.dll”

“bin\Debug\DataLayer.dll”

“bin\Debug\ReportingWebParts.dll”

;***********************************

;***     FeatureFiles section    ***

;***********************************

;*** add files for Reports feature

.Set DestinationDir=ReportingWebParts

“C:\Ravendra\ReportingWebParts\ReportingWebParts\feature.xml”

“C:\Ravendra\ReportingWebParts\ReportingWebParts\WebParts.xml”

;*** add files for Reports\WebParts feature

.Set DestinationDir=ReportingWebParts\WebParts

“C:\Ravendra\ReportingWebParts\\ReportingWebParts\\WebParts\DistributorActivityByAccountManager.webpart”

“C:\Ravendra\ReportingWebParts\\ReportingWebParts\\WebParts\ReportOfOutcomesReport.webpart”

“C:\Ravendra\ReportingWebParts\\ReportingWebParts\\WebParts\ReportByShippingCompanyReport.webpart”

“C:\Ravendra\ReportingWebParts\\ReportingWebParts\\WebParts\ReportByProductReport.webpart”

  1. manifest.xml

<?xml version=”1.0″ encoding=”utf-8″?>

<!–Manifest created at 30/11/2009 09:41:19–>

<Solution SolutionId=”40890978-145b-4684-b3b7-5c2012541795″ ResetWebServer=”True” xmlns=”http://schemas.microsoft.com/sharepoint/”&gt;

<!–Feature Manifest files–>

<FeatureManifests>

<FeatureManifest Location=”CMPMReportingWebParts\feature.xml” />

</FeatureManifests>

<!–Assembly files–>

<Assemblies>

<Assembly Location=”BusinessLogicLayer.dll” DeploymentTarget=”GlobalAssemblyCache” />

<Assembly Location=”CMPM.DataLayer.dll” DeploymentTarget=”GlobalAssemblyCache” />

<Assembly Location=”CMPMReportingWebParts.dll” DeploymentTarget=”GlobalAssemblyCache”>

<SafeControls>

<SafeControl Assembly=”CMPMReportingWebParts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=42bd3e28d7726752″ Namespace=”CMPM.WebParts.Reports” TypeName=”*” Safe=”True” />

</SafeControls>

</Assembly>

</Assemblies>

</Solution>

  1. Feature.xml

<Feature Title=”ReportingWebParts” Description=”Cusotm web parts containing reports for ” Version=”1.0.0.0″ Scope=”Site” Hidden=”false”  xmlns=”http://schemas.microsoft.com/sharepoint/”&gt;

<ElementManifests>

<ElementManifest Location=”WebParts.xml” />

<ElementFile Location=”WebParts\DistributorActivityByAccountManager.webpart” />

<ElementFile Location=”WebParts\ReportByProductReport.webpart” />

<ElementFile Location=”WebParts\ReportByShippingCompanyReport.webpart” />

<ElementFile Location=”WebParts\ReportOfOutcomesReport.webpart” />

</ElementManifests>

</Feature>

  1. Webparts.xml

<?xml version=”1.0″ encoding=”utf-8″?>

<!–Created by STSDEV at 2/11/2009 1:41:01 AM–>

<Elements xmlns=”http://schemas.microsoft.com/sharepoint/”&gt;

<Module List=”113″ Url=”_catalogs/wp” Path=”WebParts” RootWebOnly=”True”>

<File Url=”DistributorActivityByAccountManager.webpart”>

<Property Value=”ReportingWebParts” />

</File>

<File Url=”ReportByProductReport.webpart”>

<Property Value=”ReportingWebParts” />

</File>

<File Url=”ReportByShippingCompanyReport.webpart”>

<Property Value=”ReportingWebParts” />

</File>

<File Url=”ReportOfOutcomesReport.webpart”>

<Property Value=”ReportingWebParts” />

</File>

</Module>

</Elements>

  1. .WebPart files: for each webpart

<?xml version=”1.0″ encoding=”utf-8″?>

<webParts>

<webPart xmlns=”http://schemas.microsoft.com/WebPart/v3″&gt;

<metaData>

<type />

<importErrorMessage>Error importing WebParts.Reports.DistributorActivityByAccountManagerReport Web Part</importErrorMessage>

</metaData>

<data>

<properties>

<property>Distributor Activity By Account Manager Report</property>

<property>Distributor Activity By Account Manager Report</property>

<property>Normal</property>

<property>True</property>

<property>True</property>

<property>All</property>

</properties>

</data>

</webPart>

</webParts>

  1. .Bat file to create WSP package

“C:\WINDOWS\System32\makecab.exe” /F ReportingWebParts.ddf /D CabinetNameTemplate=ReportingWebParts.wsp

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: