SharePoint solution generator-Part 1: Create a site definition from an existing site

Source: Internet
Author: User
Http://weblogs.asp.net/soever/archive/2006/11/11/SharePoint-Solution-Generator-_2D00_-part-1_3A00_-create-a-site-definition-from-an-existing-site.aspx

 

This is Part 1 in a series of blog post on the SharePoint solution generator.

the SharePoint solution generator is a stand-alone application that can convert wss3 web (spweb) into a Visual Studio 2005 site definition project that can be compiled into a Sharepoint solution for deployment into your SharePoint farm. the SharePoint solution generator is part of Windows SharePoint Services 3.0 tools: Visual Studio 2005 extensions , A set of tools and templates for creating solutions for Sharepoint 2005 that recently came out in Beta. see this blog post for more information. this blog post documents the steps that I took in creating a site definition from an instantiation of a standard Windows SharePoint Services team site, and all things I noticed on the created site definition. for me it is a kind of documenting my findings in a way I can find it back when I Google for information on this topic later on. I have a short memory;-)

OK, lets get started. I created a site called teamsite based on the standard team site template. I have three language packs installed, English, German and Japan. I chose the English version.

 

Without making any modification to the team site I fire up the SharePoint solution generator and start creating the site definition solution.

The result is a C # site definition solution with the following elements in it:

The project has a Sharepoint specific Properties tab with a tree view on all features and the site definition in this project. if we had modified lists in the team site like adding new columns and new views, we probably also had list definitions sorted ded in this tree view. below are the screen shots of all the configuration screens, so you get a feeling of what configuration capabilities are dynamically created:

To prevent clashes on deployment, the specified folder name is appended with a guid to create the folder during deployment on the server.

Note that the language is set to 1033 (English), this is the language we created our instance of the teamsite in.

Microsoft advises to use unique values greater than 10,000 for the ID attribute of your site template. the value is set to 10002 as you can see in the picture above. this is because I created a test site definition before with ID 10003 and deployed it to the server. I hope that the SharePoint solution generator makes a roundtrip to the server to check for the highest site definition ID with a minimum value of 10000, and Adds 1 to it. I wonder what happens if all site definition creators in the world starts creating site definitions with the same ID's due to the usage of this tool ;-) you can also specify the image to display on Template Selection, and the name of the Template Selection tab.

Creating the SharePoint solution file teamsite. WSP and deploy it to our development server

Visual Studio can do a deployment of our project (menu: Build-> deploy teamsite, or in the context menu of the project: deploy) to the development server, assuming you have visual Studio running on your SharePoint developer server. the following appears in the Visual Studio output window:

------ Build started: Project: teamsite, configuration: Debug any CPU ------ c: \ windows \ Microsoft. net \ framework \ v2.0.50727 \ csc.exe/noconfig/nowarn: 1701,1702/errorreport: Prompt/warn: 4/define: Debug; TRACE/reference: "C: \ Program Files \ common files \ microsoft shared \ Web Server Extensions \ 12 \ ISAPI \ Microsoft. sharepoint. DLL "/reference:" C: \ Program Files \ common files \ microsoft shared \ Web Server Extensions \ 12 \ ISAPI \ Microsoft. sharepoint. security. DLL "/reference: C: \ WINDOWS \ Microsoft. net \ framework \ v2.0.50727 \ system. dll/reference: C: \ WINDOWS \ Microsoft. net \ framework \ v2.0.50727 \ system. web. dll/reference: C: \ WINDOWS \ Microsoft. net \ framework \ v2.0.50727 \ system. XML. dll/debug +/debug: Full/Keyfile: Properties \ temporary. SNK/optimize-/out: OBJ \ debug \ teamsite. dll/Target: Library properties \ assemblyinfo. CS "site provisioning Handler \ siteprovisioning. CS "" site provisioning Handler \ siteprovisioning. internal. CS "compile complete -- 0 errors, 0 warnings teamsite-> F: \ sources \ sharepointprojects \ teamsitesitedefinition \ teamsite \ bin \ debug \ teamsite. DLL ------ deploy started: Project: teamsite, configuration: Debug any CPU ------ generate teamsite. WSP file and setup batch file ------ creating solution... operation completed successfully. creating Setup batch file... operation completed successfully. ------ add and deploy teamsite. wsp to the SharePoint ------ adding solution... operation completed successfully. deploying solution... operation completed successfully. ------ activate features in solution if necessary ------ no features in this solution were activated Restarting IIS... operation completed successfully. =========== build: 1 succeeded or up-to-date, 0 failed, 0 skipped ============================== deploy: 1 succeeded, 0 failed, 0 skipped ============

As you can see the project is compiled, A SharePoint solution file teamsite. WSP is created including a batch script to simplify installation, the solution is deployed to the server and IIS is restarted so the new site definition becomes active.

This solution is a really simple solution, in more complex solutions additional steps are taken with recyclct to feature activation.

Create an instance of our new site definition

We can now create an instance of our new site definition. If we go to the create site screen there appeared an extra Template Selection tab called "development" where our new site definition appears:

And it all just works! I'm amazed.

In the next blog post I will dive deeper in what is actually created in the site definition project. This is absolutely not trivial, so please continue reading to get a better understanding of the inner workings.

[Nota bene: all information in this blog post is based on a beta version of the product, and may not reflect the functionality and behaviour of the final version]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.