Friday, December 01, 2006

SharePoint solution manifests inside and out

One of the major improvements in WSS 3 is the new solution framework, which allows the deployment of Web Parts, Features, assemblies and other files to SharePoint site or farm. The process of deploying a WSS solution has several stages: (1) Creating the solution contents; (2) Compiling the WSP (CAB) file; (3) Adding the solution to the SP site(s); (3) Deploying the solution to the target site(s).

The WSS SDK however does not explain in detail the target locations of the different types of files deployed on the server. In this post I am summarizing my observations that can help you understand what exactly happens during solution deployment.

I assume 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\.

Assemblies

The Assemblies element contains a list of assemblies to be deployed to the SharePoint web server. These can be web parts, event handlers, web services or any other class that will be used in your application. 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.

The SafeControl element is optional and if added SharePoint will put the assembly element to the SafeControls element in the web.config file of the target web application.

Features

The Features element specifies files with feature definitions.

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

Template Files

This is where most files will be added, including images, themes, web pages etc.

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

Application Resources

In this section are listed resource files specific to the target web application.

Target Folder: C:\Inetpub\wwwroot\wss\VirtualDirectories\{virtual app port}\resources\

Global Resources

The resources list contains global resources available to all web applications.

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

Root Files

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

Web Parts

To list the web parts to be deployed use the DwpFile(s) elements to specify the name of the file.

Target Folder: 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\

Dovizhdane!

10 comments:

Avner Kashtan said...

THANK YOU for posting this, and adding it to the woefully lacking MSDN documentation for solutions. Saved me a lot of guesswork and trial-and-error to see where they all end up.

Avner Kashtan said...

Thanks for your post - and for adding it to woefully lacking MSDN documentation for Solutions. Saved me a lot of trial-and-error and guesswork to see what's going on.

Mikhail Dikov said...

Avner this is great! I appreciate your feedback. This weekend I am going to speak at the South Florida code camp and present most of the info in the blog. As a result I'll post the session materials sometime next week.

Unknown said...

Hi,

How do we deploy files like .ascx or .xml using SharePoint solutions?

Mikhail Dikov said...

kishan,

There is really no difference what is the file type of the files you are deploying when you use the <TemplateFile> and the <RootFile> elements. The file are simply copied over to the respective directory (or sub directories) as described in my post.

Mikhail

Anonymous said...

Hello..

What about xsd files? I'm making a strongly typed dataset in my web part and need to reference it.. any ideas?

John Seleem

Mikhail Dikov said...

John,

It depends on how you need to reference the xsd (or any other file). If it is a local path reference create a folder in the 12 hive and use the ROOTFILES element. If the reference is a server URL use one of the folders, which are already mapped as virtual directories (such as LAYOUTS) and use the corresponding manifest element to copy the files.

Mikhail

Unknown said...

Thanks for your post ... relieved to understand how this works. I have question though ...
how do i deploy a folder (eg: config) which has our custom configs to the virtual directory c:\inetpub\..\{port}\config?

Mikhail Dikov said...

vikram,

You need to simply create a subfolder for the rootfile element. However creating WSP files by hand these days is not your best option. There are couple of tools that automate the process. Check them out:

STSDEV:
http://msdn.microsoft.com/en-us/magazine/cc337895.aspx?pr=blog

and WSPBuilder:

http://www.codeplex.com/wspbuilder

Anonymous said...

Hi,

In your previous answer you stated that need to create a subfolder to the rootfile element to deploy files to the virtual directory. Is this possible? How?
Isn't rootfile only used for the 12 hive?
I am also facing the problem of deploying files to directories other than bin, resources and wpcatalog.