Well, I guess you don't have to keep them separated, I just though including a song lyric in my blog would give me some kind of street-cred with the cool kids.
So I have abandoned my goal of single click deployment of my Intranet site. It is for a good reason though. What I've got is a need to have a small company Intranet where we can collaborate our documents, timecards, expenses, discussion forum, etc. Within the company (we are a IT Consulting/service provider), we have several concurrent projects/clients. Each one will have its own site below the primary site collection.
My previous goal of single click deployment had only considered the primary site in the site collection; the corporate intranet. I was hoping to (and still will) run my install.bat file and it will set the master page, set the theme, create my lists, populate my lists with data from the old system. I had not considered the layout file. The easiest way to deploy and set a layout file is to package it up as a site definition. In order to leverage the site definition, it has to be deployed before the site is created. Chicken...egg...chicken. For this reason, I had to separate it to a different WSP file and install it before I started creating my site.
Now if I create a sub site in my collection, I can specify the site definition with the layout I want for all sub sites.
For information on how I setup projects, see my previous post.
- Step1: Copy the 12\TEMPLATE\SiteTemplate\sts folder to my project but instead of sts, use HMBSiteDef.
- Step2: Delete the defaultdws.aspx at 12\TEMPLATE\SiteTemplates\HMBSiteDef\defaultdws.aspx in my project.
- Step3: Change the default.aspx file at 12\TEMPLATE\SiteTemplates\HMBSiteDef\default.aspx to have a third column (default has only two)
- Step4: Change the onet.xml file at 12\TEMPLATE\SiteTemplate\HMBSiteDef\XML\onet.xml
- Removed the unnecessary Modules...Here's the configuration and Modules section. My site is very simple but it's easier to start this way and grow bigger.
1: <Configurations>
2: <Configuration ID="1" Name="Blank">
3: <Lists/>
4: <Modules>
5: <Module Name="DefaultBlank"/>
6: </Modules>
7: <SiteFeatures>
8: <!-- BasicWebParts Feature -->
9: <Feature ID="00BFEA71-1C5E-4A24-B310-BA51C3EB7A57"/>
10: <!-- Three-state Workflow Feature -->
11: <Feature ID="FDE5D850-671E-4143-950A-87B473922DC7"/>
12: </SiteFeatures>
13: <WebFeatures>
14: <Feature ID="00BFEA71-4EA5-48D4-A4AD-7EA5C011ABE5"/>
15: <!-- TeamCollab Feature -->
16: <Feature ID="F41CC668-37E5-4743-B4A8-74D1DB3FD8A4"/>
17: <!-- MobilityRedirect -->
18: </WebFeatures>
19: </Configuration>
20: </Configurations>
21: <Modules>
22: <Module Name="DefaultBlank" Url="" Path="">
23: <File Url="default.aspx" NavBarHome="True" Type="Ghostable">
24: <NavBarPage Name="$Resources:core,nav_Home;" ID="1002" Position="Start"/>
25: <NavBarPage Name="$Resources:core,nav_Home;" ID="0" Position="Start"/>
26: </File>
27: </Module>
28: </Modules>
- Step5: Create a webtempHMBSiteDef.xml. Note: the name is important. This file will exist at 12\TEMPLATE\1033\XML in your project
- Code:
1: <?xml version="1.0" encoding="utf-8"?>
2: <Templates>
3: <Template Name="HMBSiteDef" ID="10001">
4: <Configuration ID="1" Title="HMB Site Definition" Description="" Hidden="FALSE" ImageUrl="/_layouts/images/stsprev.png" DisplayCategory="HMB" />
5: </Template>
6: </Templates>
- Step6: Setup the manifest.xml and build.ddf files to put the files in the right place
- build.ddf:
1: .OPTION Explicit
2: .Set DiskDirectoryTemplate=CDROM
3: .Set CompressionType=MSZIP
4: .Set UniqueFiles=Off
5: .Set Cabinet=On
6: .Set DiskDirectory1="Installers"
7: .Set CabinetNameTemplate="HMBSiteDef.wsp"
8: ;########################################
9: solution\manifest.xml
10:
11: .Set DestinationDir=1033\XML
12: 12\TEMPLATE\1033\XML\webtempHMBSiteDef.xml
13:
14: .Set DestinationDir=SiteTemplates\HMBSiteDef
15: 12\TEMPLATE\SiteTemplates\HMBSiteDef\default.aspx
16:
17: .Set DestinationDir=SiteTemplates\HMBSiteDef\XML
18: 12\TEMPLATE\SiteTemplates\HMBSiteDef\XML\onet.xml
- manifest.xml:
1: <?xml version="1.0" encoding="utf-8" ?>
2: <Solution xmlns="http://schemas.microsoft.com/sharepoint/"
3: DeploymentServerType="WebFrontEnd"
4: SolutionId="567D630A-A69C-4835-889E-DEFF652A7899">
5: <TemplateFiles>
6: <TemplateFile Location="1033\XML\webtempHMBSiteDef.xml"/>
7: <TemplateFile Location="SiteTemplates\HMBSiteDef\XML\onet.xml"/>
8: <TemplateFile Location="SiteTemplates\HMBSiteDef\default.aspx"/>
9: </TemplateFiles>
10: </Solution>
- Build & Install the WSP