Creating the Solution Package
A solution package is a CAB file with a .wsp filename extension that contains all the files that must be deployed on servers in the farm.
The first step in creating a solution package is to create manifest.xml. The second step is to create a Data Directive File (.ddf) that instructs the MAKECAB.EXE command-line utility what files to include in the output CAB file. The last step is to use MAKECAB.EXE to compile the CAB file.
To create the manifest for a solution package
To create a directive file for the solution package
- Open Visual Studio as an administrator by right-clicking the program in the Start menu and selecting Run as administrator.
- Open the project that contains the code for your rule.
- Create a Solution folder.
In Solution Explorer, right-click the project name, choose Add, and choose New Folder. Type Solution.
- Create a solution manifest file.
Right-click the Solution folder, choose Add, and then choose New Item.... In the Add New Item dialog, select the XML File template. Name the filemanifest.xml. Then click Add.
- Open manifest.xml in the editor.
- Delete the first (and only) line in the file. In its place, paste the following code.
- Replace the value of the SolutionId attribute with a newly generated GUID (without braces).
You can use the GuidGen Tool (guidgen.exe) to get a new GUID. On the Tools menu in Visual Studio, choose Create GUID. In the Create GUID dialog, select4. Registry Format, then click Copy. Paste the content of the clipboard between the quotation marks after the SolutionId attribute. Remove the braces from the GUID.
- Modify the value of the FeatureManifest element’s Location attribute, replacing “FeatureFolderName” with the name of the folder in your solution that contains the feature.xml file.
When the solution is deployed, a folder with the same name is created in the %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\FEATURES folder of every server in the farm.
- Modify the value of the Assembly element’s Location attribute, replacing “AssemblyName.dll” with the filename of your rule’s assembly.
- Save manifest.xml.
- Create a package folder in your Visual Studio project.
In Solution Explorer, right-click the project name, choose Add, and choose select New Folder. Type Package.
This is the output directory for the MAKECAB.EXE command-line utility.
- Create a Data Directive File (.ddf) in the Solution folder of your Visual Studio project.
In Solution Explorer, right-click the folder named Solution, choose Add, and then choose New Item.... In the Add New Item dialog, select the Text Filetemplate. Name the file cab.ddf. Then click Add.
This file will be used with the MAKECAB.EXE command-line utility.
- Open cab.ddf in the editor. Copy the following markup and paste it into the cab.ddf file.
.OPTION EXPLICIT ; Generate errors
.set DiskDirectoryTemplate=CDROM ; All cabinets go in a single directory.
.Set CompressionType=MSZIP;** All files are compressed in cabinet files.
.Set DiskDirectory1=Package ; This is the output directory.
; Files to include.
- Modify the value of the CabinetNameTemplate argument, replacing “SolutionName” with the filename that you want to use for your solution package. (Keep the .wsp file extension.)
- Replace “FeatureFolderName” (it occurs twice) with the name of the folder in your solution that contains the file feature.xml.
- Replace “AssemblyName.dll” (it occurs twice) with the filename of your rule’s assembly. In addition, if the relative path to the assembly is not “bin\Release\”, replace that string with the correct path.
- Save cab.ddf.
To create the solution package file
- Open a Visual Studio command prompt.
- Navigate to the directory for your Visual Studio project.
The file paths in cab.ddf and in the command that is issued in the next step are relative to the Visual Studio project directory.
- At the command prompt, issue the following command:
Uploading and Deploying the Solution
After you create a new solution package, you should test it on a SharePoint installation. This involves two tasks: First, you must upload the solution package to the server farm. Second, you must deploy the solution.
|Note: Your solution includes a Feature that is scoped at the server farm level. Because a farm-level Feature is automatically activated when it is installed, you do not need to issue a command to activate it manually.|
To upload and deploy a solution package to the farm
- Open SharePoint Management Shell as an administrator by right-clicking the item on the Start/Administrative Tools menu and then selecting Run as administrator.
- At the command prompt, issue the following command to upload the solution. (Substitute the full path and filename for your solution package.)
The solution package is now uploaded to the server farm.
- At the command prompt, issue the following command to deploy the solution. (Substitute the correct filename for your .wsp file.)