MOSS11 / Creating a Solution for SharePoint Server

SharePoint team and Project server team at Maven Infosoft has great experience of creating web application based on MOSS 2007 and Project server 2007. That includes customization and development of webpart, site definitions, theme development, extension development, module creation. The team has developed CRM application, Job portal, Project management, to CMS applications based on MOSS 2007 and project server 2007.

Team would like to share same experience. This can help who wanted to begin with the sharePoint development and Project Server development.

There are list of articles start with SP and from number 1 to … Always start with the article SP1 and read next article to start working on MOSS easily and quickly.

Creating a Solution:

A solution package is a cabinet (.cab) file with a .wsp file name extension and a manifest file. It can contain the following components:

  • Site definitions
  • Feature definitions and their corresponding element definitions and files
  • Web Part files (*.webpart, *.dwp)
  • Template files and root files, which can include the following:
    1. _layouts files
    2. Resources(*.resx)
    3. Resource files(for example, *.doc or *.xls)
  • Assemblies, which can include the following:
    1. Safe control entries
    2. Resources
  • Code access security policies

Solution files have a hierarchical structure a manifest file is at the root while feature, resource, or site definition directories are contained in subdirectories. In turn, feature definitions define where associated files are located inside of the solution.

The solution creator can define the remaining structure; however, it is recommended that files for a particular feature or site definition be placed in that feature or site definition’s subdirectory.

Note:

The directory structure inside of the .wsp file determines the final directory structure on the front-end Web server file system.

To create a solution package, perform the following steps:

  • Create a solution manifest.xml file.
  • The solution manifest (always called manifest.xml) is stored at the root of a solution file. This file defines the list of features, site definitions, resource files, Web Part files, and assemblies to process. It does not define the file structure if files are included in a solution but not listed in the manifest XML file, they are not processed in any way.

    Following is the structure of a manifest.xml file.

    XML

<Solution SolutionId=”4AFC1350-F354-4439-B941-51377E845F2B” xmlns=”http://schemas.microsoft.com/sharepoint/”>

<FeatureManifests>
<FeatureManifest Location=”FeatureLibraryfeature.xml”/>
</FeatureManifests>
<TemplateFiles>
<TemplateFile Location=”ControlTemplatesFeaturelibraryform.ascx”/>
</TemplateFiles>
<RootFiles>
<!– These files go into the 12 directory and can be used for Web services and global resources –>
<RootFile Location=”ISAPIMyWebService.asmx”>
</RootFiles>
<Assemblies>
<Assembly DeploymentTarget=”GlobalAssemblyCache”
Location=”ms.samples.sharepoint.myFeature.dll”/>
</Assemblies>

</Solution>

In addition, you can add a DwpFiles element to specify .webpart or .dwp files, or a ResourceFiles element to specify resource files, site definitions, application resources, and code access security policies.

  • Optional. Annotate your feature.xml files with tags.

In the <ElementManifests> tag in your feature.xml file, add <ElementFile Location=”…”/> for all of the extra files in your feature, such as .aspx pages (for example, allitems.aspx) or master pages, and so on.

Note:

This step is required only if your solution contains features.

  • Create your solution package (the .wsp file).

Because the solution file is essentially a .cab file, use the makecab.exe tool to create the solution package. The makecab.exe tool takes a pointer to a .ddf file, which describes the structure of the .cab file. The format of a .ddf file is basically in the same style as the .inf file you declare a standard header and then enumerate, one file per line, the set of files by where they live on disk, separated by where they should live in the .cab file.

Xml

.OPTION EXPLICIT; Generate errors
.Set CabinetNameTemplate=MySolutionFile.wsp
.set DiskDirectoryTemplate=CDROM ; All cabinets go in a single directory
.Set CompressionType=MSZIP;** All files are compressed in cabinet files
.Set UniqueFiles=”ON”
.Set Cabinet=on
.Set DiskDirectory1=Package
buildmanifest.xml manifest.xml
build MySolutionFile feature.xml MySolutionFile feature.xml

Installation Instructions:

Prerequisites:

- Installation package: LHH.PageLayoutsAndLists.wsp

- Flash Player installed on the client to access the site.

From cmd go to: “C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12bin”

  • Adding Solution:

Run this command:
Stsadm.exe -o addsolution -filename C:TempLHH.PageLayoutsAndLists.wsp

  • Deploying Solution:

Run this command
Stsadm.exe -o deploysolution -name LHH.PageLayoutsAndLists.wsp –local -allowgacdeployment

  • Activating Features:

From LHH Portal Site go to Site Actions >> Site Settings >> Modify All Site Settings

Site Collection Features
Activate:
LHH Content Types
LHH Master Page and Page Layouts

  • Referencing content types:

Go to “Site Actions” >> View All Site Content >> Pages
Click on “Document Library Settings”
Click on Advance Settings >> Allow Manage Content Types (True) >> Ok

Then Go to

Site actions -> Site setting -> modify all settings

Site collection administration -> site collection feature

solution site settings

Then you will see the site collection feature list, active our feature from the list. We will have all the features available.

solution site features

Related Post