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:

    • _layouts files

    • Resources (*.resx)

    • Resource files (for example, *.doc or *.xls)

  • Assemblies, which can include the following:

    • Safe control entries

    • 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 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:

  1. 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="FeatureLibrary\feature.xml"/>
      </FeatureManifests>
      <TemplateFiles>
        <TemplateFile Location="ControlTemplates\Featurelibraryform.ascx"/>
      </TemplateFiles>
      <RootFiles> 
      <!-- These files go into the 12\ directory and can be used for Web services and global resources -->
        <RootFile Location="ISAPI\MyWebService.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.

  2. Optional. Annotate your feature.xml files with <ElementFile> 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 Note:

    This step is required only if your solution contains features.

  3. 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
    build\manifest.xml manifest.xml
    build\ MySolutionFile \feature.xml MySolutionFile \feature.xml
    ...

See Also

Tags :


Community Content

barbara.toualbia
Target path locations for solution files

Assuming that WSS was installed in the default installation location, which for most WSS files is C:\Program Files\Common Files\Microsoft Shared\web server extensions\12 and for the virtual directories is C:\Inetpub\wwwroot\wss\VirtualDirectories\, when the solution is deployed each file described in the solution manifest elements is copied to a praticular location. Here is a list of these locations:

Assemblies 

The parameter DeplymentTarget determines whether to deploy the assembly to the GAC or to a directory (WebApplication).

With the GAC option assemblies are copied to C:\WINDOWS\assembly. With the WebApplication option the files are copied to C:\Inetpub\wwwroot\wss\VirtualDirectories\80\bin.

Features:  C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\

TemplateFiles:  C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\

Application Resources:  C:\Inetpub\wwwroot\wss\VirtualDirectories\{virtual app port}\resources

Global resources:  C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\

Web Parts:  C:\Inetpub\wwwroot\wss\VirtualDirectories\80\wpcatalog

Site definitions
The SiteDefinitionManifests list contains descriptions of all site definition folders. The Location attribute defines the name of the folder that contains the site definition. This folder contains the ONET.xml and other components of the site definition.

Target Folder: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates

 

Tags : contentbug

Page view tracker