I need to create a site definition (as I tried to re-use a wsp site template to extend it but failed).

Is it possible to create a site definition with 16 list instances (with a variety of types, 100, 101, 109, doc lib, list, form lib, pic lib, pages)? I also have to add 8 aspx pages. I then need to remove the default.aspx page and make one of the 8 pages the default landing page. The remaining 7 aspx pages should have web parts (based on the list just created from list instances) and 2 aspx page also have cewp. I also need to add feature activation receiving code to activate the publishing feature.

Is it possible? (I am not looking for code). I really want a clear picture of all I need to do to accomplish above goal. (How long do you think I should tell my boss it will take)?

When it's all done it needs to be deployed in such a fashion that when end user clicks on create site he should see this as an available option. (How do I deploy to 5 different machines with Visual Studio)?

Leslie Robinson

  • Good question! But you probably should not expect people to want to estimate how long time it takes to develop certain functionality ;-) Especially for SharePoint this will vary by miles depending on how used you are to working with the product. Commented May 5, 2011 at 7:08

2 Answers 2


I would pass on a custom site definition and use the new WebTemplate element with features. Everything you have listed can be done with a WebTemplate - sounds like it can even be deployed as a Sandbox solution. Here is a link to my blog post on Web Templates.


  • Thanks for the link and hope. LOL. So how do I add the aspx pages. (also need to remove the default.aspx page and make g2main.aspx as landing page). It seems creating lists would be that hard (they all go in onet.xml right?). How do I add webpart? Will the end user see the available template when they click on create site? I spent last 4 days and i am VERY CONFUSED. Commented May 5, 2011 at 5:21
  • +1, good article! @Leslie robinson, you mentioned in the question that you're not looking for code, isn't it? :) Please, correct your question or add another one if you need extra information. Btw, all you mentioned can be done easily, I don't see any problems here. Commented May 5, 2011 at 6:42
  • +1 to custom web templates, unfortunately they are poorly documented, so nice to see a decent blogpost on the subject (will post one myself soon as well). Yes it does support sandboxed solution, since its intended use is SharePoint Online where writing to SharePointRoot is a no-no. Read the definitive article on the subject by Vesa here: blogs.msdn.com/b/vesku/archive/2010/10/14/… you add pages using features and modules (same modules you se defined in OOB site definitions) Commented May 5, 2011 at 6:58
  • Vesa's blog post is the comprehensive post on the subject (I wrote mine first though :) If you download the sample code on my post it shows how to deploy the default page with the template. List Definitions work exactly the same but you put them into features. Yes, the user will see them in the site picker with other templates. Commented May 5, 2011 at 9:04

Agree on Chris, custom web templates is the way to go in SP2010!

You can define list instances declaratively. Actually they work the same way as custom web templates: in your list instance element in your element manifest use the CustomSchema property to make SharePoint disregard the OOB list template and use your schema instead.

See a description here on how to use it.

The easiest way to achieve what you need is to build it in a mockup site and extract all your list instances, pages with web parts (modules) by saving the page as template (_layouts/savetmpl.aspx) and save it to the disk from user code gallery.

Then import that into Visual Studio as a WSP import project and select the modules and elements you need (i usually import it into a temporary project and then copy paste the SharePoint Items (SPI) into the folders of my existing project and use the "include in project" functionality to get not only the module, but the right deployment type, deployment location etc.

See this MSDN article for guidance on how to import functionality into Visual Studio 2010.

  • +1 on using a temporary project. I get the feeling a lot of newcomers think that an imported WSP (from a saved template) is good enough to get running as a full VS solution, but it has far too much noise for most projects.
    – James Love
    Commented May 5, 2011 at 7:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.