SharePoint Solution Generator - part 1: create a site definition from an existing site

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 Japanese. 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 included 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 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 repsect 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]

Published Saturday, November 11, 2006 11:36 PM by svdoever
Filed under:

Comments

Tuesday, November 14, 2006 1:06 AM by Christopher Steen

# Link Listing - November 13, 2006

Advanced .NET Master Class next month...win a free seat! [Via: gduthie ] SharePoint Solution Generator...
Wednesday, November 15, 2006 10:47 AM by ScottGu's Blog

# Office 2007, VS 2005 Tools for Office, and VS 2005 Extensions for SharePoint

Last week Microsoft released Office 2007. For those of you who haven't tried it yet, this is probably

Friday, November 17, 2006 4:23 AM by Pablo Alvarez

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

Hi,

 thanks for the document.

I am trying to deploy a site definition solution, but i get 503 error, it uses a web service to deploy the definition?

thanks

Friday, January 05, 2007 6:08 AM by Himadrish

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

Great stuff!

Thanks for publishing it:-)

Friday, January 19, 2007 7:28 AM by Alfredo Simoes

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

hi, i get this error when trying to deploy

Illegal characters in path.

  at System.Security.Permissions.FileIOPermission.HasIllegalCharacters(String[] str)

  at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)

  at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, AccessControlActions control, String[] pathList, Boolean checkForDuplicates, Boolean needFullPath)

  at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)

  at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)

  at System.IO.File.Open(String path, FileMode mode, FileAccess access)

  at Microsoft.SharePoint.Tools.Utilities.CabCreateProcessor.OpenFile(String pszFile, Int32 oflag, Int32 pmode, Int32& err, IntPtr pv)

  at Microsoft.SharePoint.Tools.Utilities.SafeNativeMethods.Create(IntPtr perf, PFNFILEPLACED pfnfcifp, PFNALLOCMEM pfna, PFNFREEMEM pfnf, PFNOPENFILE pfnopen, PFNREADFILE pfnread, PFNWRITEFILE pfnwrite, PFNCLOSEFILE pfnclose, PFNSEEKFILE pfnseek, PFNDELETEFILE pfndelete, PFNGETTEMPFILE pfnfcigtf, CabInfo pccab, IntPtr pv)

  at Microsoft.SharePoint.Tools.Utilities.CabCreateProcessor.get_FileCompressioinHandle()

  at Microsoft.SharePoint.Tools.Utilities.CabCreateProcessor.Dispose(Boolean disposing)

  at Microsoft.SharePoint.Tools.Utilities.CabCreateProcessor.Dispose()

  at Microsoft.SharePoint.Tools.Utilities.CabCreator.CreateCabinet(String sourceDirPath, String cabFilePath)

  at Microsoft.SharePoint.Tools.SharePointSolutions.SolutionDeployer.Deploy()

========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========

========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========

can you help me?

thx,

alfredo

Sunday, January 21, 2007 5:52 PM by Serge van den Oever

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

I get a lot of questions with respect to the SharePoint Solution Generator. I'm afraid I don't have many answers. I did some tests. I works with the standard stuff, but as soon as I really try to do something with it it blows up in my face. I'm curently working on a SharePoint Software Factory, using some of the ideas I got from the beta version of Windows SharePoint Services 3.0 Tools: Visual Studio 2005 Extensions, so I'm exploring a different direction. In the mean time we all have to wait for a more stable version of the tools!

Wednesday, February 07, 2007 10:59 PM by Ethnor Jacob

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

Its Really Working... WOWWW...

Thursday, February 15, 2007 8:07 AM by Patrik Luca

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

If I try to deploy the solution with the setup.bat file it is always deployed to the default url http://moss2007. How can I deploy it to another url? I adapted already the targeturl parameter in the setup.bat file, but still the solution is deployed to http://moss2007.

Further: each solution created with the SharePoint Solution Generator has as scope 'web'. As a result the solution is globally deployed, and I am not able to deploy it to a specific site collection. I tried to change the property in Visual Studio to 'site', but still, during deployment out of Visual Studio 2005, my solution is globally deployed.

It is also a bit 'strange' you have to deploy the solution first out of Visual Studio 2005 to have all relevant files. If I only 'build' the solution, I don't have all necessary files to be able to deploy the solution by use of the stsadm tool.

Thursday, February 15, 2007 8:15 AM by svdoever

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

Hi Patrik,

The product is still very beta... That is why I wrote my complete own version of the templates, packaging and deployment. The configuration settings in the properties don't work yet. You can't change scope because these properties don't work yet. I'm afraid you have to wait for the next versions to do the things you want...

Friday, February 23, 2007 8:28 PM by Philip Lanier

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

Great write up!

One thing to be aware of... it creates a LOT of global features.  For instance, I modified an OTB Team site, adding a list and a couple web parts. The resulting solution deployed 23 new features to the TEMPLATE/FEATURES directory.  

Not a deal breaker, but seems like a lot of overhead!  Might want to think twice before creating 10 new site definitions using this. :-)

Friday, March 02, 2007 2:48 AM by Health man

# Health man

I think I already trapped in that "pseudo dementia" ... I guess now I understand  lately I have big problems with my shorten-memory ... WBR LeoP

Tuesday, April 17, 2007 11:21 AM by Michelle

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

This tool has problems. If you try to embed a Site Content Type into a Document Library and then choose to "Allow management of content types" you will end up with a List Content Type with no Site Content Type parent. This is not advised!

Tuesday, May 01, 2007 4:27 PM by Mishel

# Good site

<a href=http://07.vip-get.info/sex-hypno-girls-xxx/>sex hypno girls xxx</a>|

<a href=http://07.vip-get.info/dreamcast-hope-last/>dreamcast hope last</a>|

<a href=http://07.vip-get.info/ski-stunt-simulator-2/>ski stunt simulator 2</a>|

<a href=http://07.vip-get.info/dreamcast/>dreamcast</a>|

<a href=http://07.vip-get.info/cameron-desnuda-diaz/>cameron desnuda diaz</a>|

<a href=http://07.vip-get.info/foto-moria-desnuda/>foto moria desnuda</a>|

<a href=http://07.vip-get.info/free-betty-boop-wallpaper/>free betty boop wallpaper</a>|

<a href=http://07.vip-get.info/paola-maltese/>paola maltese</a>|

<a href=http://07.vip-get.info/stacy-keibler-wallpaper/>stacy keibler wallpaper</a>|

<a href=http://07.vip-get.info/kelly-hu-wallpaper/>kelly hu wallpaper</a>|

<a href=http://07.vip-get.info/desnuda-hayek-salma/>desnuda hayek salma</a>|

<a href=http://07.vip-get.info/aames-home-loan-wholesale/>aames home loan wholesale</a>|

<a href=http://07.vip-get.info/john-cena-wallpaper/>john cena wallpaper</a>|

<a href=http://07.vip-get.info/russian-young-hardcore-gymnastic/>russian young hardcore gymnastic</a>|

<a href=http://07.vip-get.info/anna-kournikova-nude/>anna kournikova nude</a>|

<a href=http://07.vip-get.info/angel-locsin-scandal-pic/>angel locsin scandal pic</a>|

<a href=http://07.vip-get.info/bombay-furniture/>bombay furniture</a>|

<a href=http://07.vip-get.info/marvel-vs-capcom-2-dreamcast/>marvel vs capcom 2 dreamcast</a>|

<a href=http://07.vip-get.info/xem-phim-hong-kong/>xem phim hong kong</a>|

<a href=http://07.vip-get.info/paintball-myspace-layouts/>paintball myspace layouts</a>|

Friday, May 04, 2007 1:27 AM by Janakiraman C

# SharePoint Solution Generator - part 1: create a site definition from an existing site

Hi,

   Great Stuff for solution package.

 I have created .wsp file and deployed it to my url successfully.  After the deploy I tried to open my Url.  It displays an error msg ("An error occurred during the compilation of the requested file, or one of its dependencies. Cannot convert type 'Microsoft.SharePoint.WebControls.DelegateControl' to 'System.Web.UI.IAttributeAccessor'").

Can U guide me how to resolve this err.

Thanx...

Tuesday, May 08, 2007 10:18 PM by Paulk

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

I try to deploy and get the error message : No Sharepoint site exists at the specified URL.

Thursday, May 10, 2007 3:21 AM by Renjini

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

I tried to create a solution using Solution generator.I deployed it successfully.But when i try to open the site i am getting the error message  "An error occurred during the compilation of the requested file, or one of its dependencies. Cannot convert type 'Microsoft.SharePoint.WebControls.DelegateControl' to 'System.Web.UI.IAttributeAccessor'"

Please resolve this...

Thanks

Friday, May 25, 2007 6:51 AM by Pauli Visuri

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

The error "No Sharepoint site exists at the specified URL" seems to be caused by the Solution Generator not getting sufficient access to directories in IIS. I managed to correct this by enabling both "basic authentication" and "integrated windows authentication" on the the sharepoint virtual site in IIS.

Thursday, May 31, 2007 6:11 AM by Ibrahim

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

Hi,

I tried to create a solution with solution generator but im getting an error as "Sharepoint solution generator cannot create site definition of this type"

Tuesday, June 05, 2007 5:25 AM by keutmann

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

Try out this tool

www.codeplex.com/wspbuilder

Wednesday, June 27, 2007 11:33 AM by tony

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

I got the same error

cannot convert type 'Microsoft.SharePoint.WebControls.DelegateControl' to 'System.Web.UI.IAttributeAccessor'

Help?

Sunday, August 19, 2007 12:23 PM by Matt

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

This looks very interesting, if only I could get it to work for me...

I created a basic Team Site in IE, ran the Solution Generator, opened it in Visual Studio.  When I try to deploy back to the SharePoint server or view the 'SharePoint Solution' properties, I receive the follwoing error:

Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.

Anyone else seen this or advise a way round it?

Thanks

Friday, September 07, 2007 12:27 AM by Laxmikant

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

The error "No Sharepoint site exists at the specified URL" seems to be because it sets the start url to default port 80.

Go To proerties of the project -> Debug and change the start url to some sharepoint site in the farm.

This should solve..

Laxmikant

Thursday, September 13, 2007 2:08 AM by minaz

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

i tried to create a site definition using solution generator and deployed the solution to a particular site url.

But when i tried creating a subsite or any other site using the site definition templates (via create site collection option ) it gives me an error given below.

The template you have chosen is invalid or cannot be found.

Troubleshoot issues with Windows SharePoint Services.

Tuesday, October 02, 2007 7:02 AM by Tintas Barnes

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

For what kind of site types is good the solution generator?

Wednesday, November 07, 2007 10:53 PM by Him Chan

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

I got an error when trying to use the software to generate solution, the error is 'export failed'. The status is under 'Copy base List Definitions'.  Could anyone know what is the problem.

I'm base on the expense template to add some views and workflow.

Monday, November 12, 2007 2:59 PM by Sean McLellan

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

I've used the solution generator with other sharepoint sites, but today I encountered the error that Him Chan is having... it says that the export failed and provides no further info -- any thoughts?

Wednesday, November 21, 2007 12:47 AM by sasi.paritala@hcl.in

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

hi really cool but i got an error site with that url not exists and i changed the project properties -> debug to my site url . cool :) it worked for me.

Friday, November 30, 2007 11:00 AM by discovia

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

How can I get this to deploy so it's available for creating a new site collection?  The site definition displays for creating a sub site, but not for a site collection?  

Ripping hair out...

Friday, November 30, 2007 1:06 PM by discovia

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

The reason My site definition was not shoping under central admin is because Central Admin is not on a FWS.  What do you do in this case?  Is there an easy way to deploy to Central Admin that's not a FWS?

Monday, December 03, 2007 4:21 AM by Ram

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

hi,

I have a Site definition for site collection (i.e. a Top Level Site) which has 8 lists (created as list definitions and activated as site features within the Site definition onet.xml). NOTE: one of the list named as CUSTOMER has a event handler attached to the Itemaddint event.

What i need to do is create a sub site definition for a subsite under the top level site. This sub site definition would be used for provisioning a subsite under the top level site (see above) programatically when a record to the CUSTOMER list is added.

I have the top level site definition created and its working fine. but when i use a sub site defintion and try to create a subsite under the top level site. it gives me an error "Invalid template or template not found".

Could you let me know how to go about creating a site definition for top level site and a sub site and use it programatically.

TopLevelSite              -> based on Site Defintion

   |   MyList   - on item added on this list a subsite should get provisioned (based on site definition) that would have 2 lists

   |

   \SubSite               -> gets provisioned when a new item is added to MyList

       |

       |         2 lists gets created along with this subsite

Ram

Wednesday, December 19, 2007 6:21 AM by Vishal Shah

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

it really works, i have made a new Site collection &  it successfully works..

Friday, January 11, 2008 6:25 AM by J.A. García Barceló

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

For those with 'Illegal characters in path' errors, please read jagbarcelo.blogspot.com/.../illegal-characters-in-path-deploying.html.

If you are using non-english systems(OS, VS2005, WSS3.0), please check it!

Thursday, January 31, 2008 7:00 AM by s

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

hi

pls tell me where can i sharepoint generator download free?  saeed@corc.ir  tnx a lot

Thursday, February 14, 2008 8:25 AM by adx

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

Wednesday, February 27, 2008 1:34 PM by rayudu

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

Hi i have created a publishing site and the site should not create a subsite. How can i achieve that. When i kept the availablewebtempaltes to null also it is creating sub sites. thanks in advance.

Rayudu

Thursday, June 19, 2008 5:45 AM by RupaliGK

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

Hi,

First of all, Thanks a lot for a good article.

I have created a wsp file for the SharePoint Team site with some custom lists.

When I create a new list with the newly generated Site template, these custom lists are created. But not available in Quick Lunch. Although in SharePoint Solution tab of Visual studio project, I can see the setting for Quick Launch default setting as TRUE.

Any Idea, why I don't see these lists instances in the Quick Launch toolbar.

Thanks in Advance,

Rupali Kothawade

Tuesday, June 24, 2008 11:21 AM by Siva

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

Hi,

Thanks for your nice article.  I am facing a problem with the solution generator.  I created a sitecollection with some lists and subsites.  through solution generator i created a visual studio solution file.  then i deployed the solution file to a .wsp under sharepoint scope.  Now i created a new sitecollection based on the .wsp(i.e. custom template) file.  In this point i am not able to find the subsites i created under the site collection.  Can anyone suggest me where i am going wrong?  OR is this a limitation of the sharepoint solution generator?

Thanks in advance

Siva

Wednesday, June 25, 2008 3:07 AM by Serge van den Oever

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

Hi Siva,

With the Solution Generator you can create a site definition from a single site, not from a collection of sites. So sub-sites will not be part of the generated solution.

Regards,

Serge

Friday, June 27, 2008 2:39 AM by Siva

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

Hi Serge,

  Thanks for your reply.  I got the solution.  In the SiteProvisioning.cs file i added code for creating sites under sitecollection.  That works fine.

Regards,

Siva

Monday, July 21, 2008 4:04 PM by Rolando Escobar

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

Good.. 2 considerations.

1.- considere language.... and versions. I tried in 2 machine with the same configurations no error...

2.- when you instaled in a machine a component vg. U2U and try deploy in another machine if you don't installed the component you have an error.

thank

Rolando Escobar

(I speack spanih, sorry with my english).

rolando.escobar@interdata.cl

(from Chile).

Wednesday, October 01, 2008 4:04 PM by Eugene

# re: SharePoint Solution Generator - part 1: create a site definition from an existing site

Thank for your article. It was very helpful for me.

Leave a Comment

(required) 
(required) 
(optional)
(required)