Share via


Creating a Solution

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

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

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.

    <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

    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.

    ;
    .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

Concepts

Solution Schema

Solutions Overview