Creating and deploying a custom site definition for MOSS 2007
by Adam Conde
I’ve spent the last couple weeks trying to create a custom site definition for SharePoint 2007. If you’re unsure of what a custom site definition is and how it differs from a site template, there is a good MSDN article which explains both.
I found a bunch of good resources out there that describe the steps in creating a custom site definition, but none gave me everything I needed. I will give a brief rundown of the steps that I followed, and provide links to the articles that I referenced.
- Download WSPBuilder and the WSPBuilder Extensions for Visual Studio. (I believe you need to install the Visual Studio SDK prior to installing the extensions)
- In Visual Studio create a new WSPBuilder Project.
- I don’t know if it is supposed to be this way or just a problem that I was having, but it did not create the entire 12 hive folder structure like I thought it would. To fix this, I ran WSPBuilder.exe –createfolder true from the command line, and then added the resulting folder structure to my Visual Studio project.
Then follow these steps: Creating a Custom WSS Site Definition [2007]
- In the example from that article, the author uses a folder named SampleMPS. In your Visual Studio project, you will be using the \12\TEMPLATE\ directory.
Now, I wanted to associate a custom masterpage to my site definition. The steps I followed to do that are outlined here: http://statto1974.wordpress.com/2007/04/30/using-a-custom-master-page-in-a-site-definition/. Put your master file in the \12\TEMPLATE\SiteTemplates\v2DefaultOrg\ (where v2DefaultOrg is whatever you named your site definition) directory, beside the default.aspx file. Below is a screenshot of my project folder structure. You’ll notice the eight folders in my FEATURES folder. The first is a feature that, when activated, associates a site with a new custom masterpage (read more). The remaining seven are custom list definitions. I have two site definitions in my project 1) v2DefaultOrg and 2) v2DefaultUser.
Once you have everything setup as you like. Right-click on the project and choose WSPBuilder –> Deploy. Then go into SharePoint and test out your Site Definition by creating a new site using it.
When you’re ready and it’s time to package it up and deploy it on your production SharePoint farm. Right-click on the project again and choose WSPBuilder –> Create deployment folder.
Then go to your project BIN folder and you’ll see a deploy folder. Inside this folder you should see a setup.exe and a .wsp file. The .wsp file is the Solution Package, and the setup.exe is from the SharePoint Solution Installer project on CodePlex. You’ll need to create and modify a configuration file as described on the SharePoint Solution Installer home page.
Then you simply need to run the setup.exe and the project should install on your SharePoint farm.
As I’ve found creating and deploying a custom site definition can be frustrating. Hopefully the information I’ve provided will be of help to someone.
Tags:
C#,
MOSS 2007,
SharePoint
0 comments
Kick things off by filling out the form below.
Leave a Comment