The following helps you to create .wsp (webpart solution package) for MOSS development without having WSP builder. Follow the below steps to generate wsp file.
- Create DeploymentFiles folder in your project. Have a folder structure in the project as given below.
- Create the file manifest.xml and the following is the sample content.
xml version="1.0" encoding="utf-8" ?>
<Solution xmlns="http://schemas.microsoft.com/sharepoint/"
SolutionId="412ACEA2-48D9-42f2-9794-4715258BB6F0"ResetWebServer="FALSE">
<Assemblies> <Assembly DeploymentTarget="GlobalAssemblyCache" Location="WSPCreationApp.dll"> <SafeControls> <SafeControlAssembly="WSPCreationApp, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=d42377719d795a18" Namespace="WSPCreationApp"TypeName="*" Safe="True" />
SafeControls>
Assembly>
Assemblies>
<TemplateFiles>
<TemplateFile Location="XML\TestFile.xml" />
TemplateFiles>
Solution> - Create the file BuildSharePointPackage.ddf and the following is the sample content.
.Set DiskDirectoryTemplate=CDROM
.Set CompressionType=MSZIP
.Set UniqueFiles=Off
.Set Cabinet=On
.Set CabinetFileCountThreshold=0
.Set FolderFileCountThreshold=0
.Set FolderSizeThreshold=0
.Set MaxCabinetSize=0
.Set MaxDiskFileCount=0
.Set MaxDiskSize=0
;**************************************************
DeploymentFiles\manifest.xml
%BuildDir%\WSPCreationApp.dll
.Set DestinationDir=XML
RootFiles\TEMPLATE\XML\TestFile.xml - Create the file BuildSharePointPackage.targets and the following is the sample content.
xml version="1.0" encoding="utf-8" ?>
<Project DefaultTargets="BuildSharePointPackage" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MakeCabPath>"MAKECAB.EXE"MakeCabPath>
PropertyGroup>
<Target Name="BuildSharePointPackage">
<Exec Command="$(MakeCabPath) /F DeploymentFiles\BuildSharePointPackage.ddf /D CabinetNameTemplate=$(MSBuildProjectName).wsp /D DiskDirectory1=wsp\$(Configuration) /D BuildDir=$(OutputPath) "/>
<Exec Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU'"Command="$(MakeCabPath) /F DeploymentFiles\BuildSharePointPackage.ddf /D CabinetNameTemplate=$(MSBuildProjectName).cab /D DiskDirectory1=wsp\$(Configuration) /D BuildDir=$(OutputPath) "/>
Target>
Project> - Create the file WSPCreationApp.Bat and the following is the sample content.
Rem Retracted Solution
stsadm -o retractsolution -name WSPCreationApp.wsp -allcontenturls -immediate
Rem Deleted Solution
stsadm -o deletesolution -name WSPCreationApp.wsp -override
Rem Added Solution feature
stsadm -o addsolution -filename WSPCreationApp.wsp
Rem Deployed Solution
stsadm -o deploysolution -name WSPCreationApp.wsp -url http://learning -immediate -allowgacdeployment -force - Modify the .CSProj /.VBProj file with the following entries.
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="DeploymentFiles\BuildSharePointPackage.Targets" />
<Target Name="AfterBuild">
<CallTarget Targets="BuildSharePointPackage" />
Target> - Build the project. You should be having a wsp folder gets created with .cab and .wsp inside it.
You are done! Happy Coding.!!
~ Gangadhar Kotu
No comments:
Post a Comment