SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When developing for WSS 3 and 2007 Sharepoint, I used the siteprovisioning.cs file quite a bit. I am unable to locate that functionality in VS 2010 and Foundation 2010. Is it gone? Do you do it differently??

share|improve this question
up vote 1 down vote accepted

Yeah i noticed it was gone when i went to build some site definitions in vs2010, it was a good time to learn how to do it the feature stapling way:

onet.xml (site definition)

<?xml version="1.0" encoding="utf-8"?>
<Project Title="" ListDir="$Resources:core,lists_Folder;" Revision="2" xmlns:ows="Microsoft SharePoint" xmlns="">
    <Configuration ID="0" Name="SOMENAME" MasterUrl="_catalogs/masterpage/v4.master">
        <Module Name="SOMEMODULE" />
        <!-- BasicWebParts Feature -->
        <Feature ID="00BFEA71-1C5E-4A24-B310-BA51C3EB7A57" />
        <!-- Three-state Workflow Feature -->
        <Feature ID="FDE5D850-671E-4143-950A-87B473922DC7" />
        <!-- TeamCollab Feature -->
        <Feature ID="00BFEA71-4EA5-48D4-A4AD-7EA5C011ABE5" />
        <!-- MobilityRedirect -->
        <Feature ID="F41CC668-37E5-4743-B4A8-74D1DB3FD8A4" />
        <!-- WikiPageHomePage Feature -->
        <Feature ID="00BFEA71-D8FE-4FEC-8DAD-01C19A6E4053" />
        <!-- Custom Features -->
    <Module Name="SOMEMODULE" Url="" Path="">

webtemp_*.xml (site definition template)

<?xml version="1.0" encoding="utf-8"?>
<Templates xmlns:ows="Microsoft SharePoint">
  <Template Name="SOMETEMPLATE" ID="13501">
    <Configuration ID="0" Title="SOMETITLE" Hidden="FALSE" 
        Description="" DisplayCategory="Collaboration">

Elements.xml (feature stapling)

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="">
  <FeatureSiteTemplateAssociation Id="SOMEGUID" TemplateName="YourSiteDefinition#0" />

Then have you standard feature with event receiver

share|improve this answer

I don't have an answer I just have the same question. Have you found out any information about this? If so please share.

share|improve this answer
What I have found so far is that you can accomplish the same thing using a feature and its receiver functions. The project now has a Sharepoint section in the properties where you can select pre and post features where this can be done. I have not yet had time to do it, but it appears to be the method you use. – spevilgenius Dec 2 '10 at 7:09
I can't find the location for pre and post features, except command line items. Also it appears that they fire before the users for the site are applied and since the first thing that I need to do is "currentWeb.BreakRoleInheritance" that doesn't help. – misterscratch Dec 2 '10 at 17:00
The .csproj if you right click and go to properties there is now a Sharepoint tab on the left where you can select that stuff. – spevilgenius Dec 2 '10 at 20:57
That is the post-deployment command line as in when the solution is deployed to the server. I am currently trying adding a Feature and scoping it to Site and then adding to onet.xml. I may then add a thread to the feature to check that the site is provisioned. – misterscratch Dec 2 '10 at 21:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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