I'm developing a Web Template, extending the Blank template. I had some code in a web feature receiver to place webparts on the web's default.aspx but ran into a similar issue to this: the page default.aspx, provisioned as a module defined and referenced in onet.xml, wasn't created until after the feature receiver had already fired.

If I create a new module in my package in Visual Studio, containing a copy of the default.aspx file from 14\TEMPLATE\SiteTemplates\sts, add this module to my web feature, and deploy, everything works fine.

This seems a bit of a hack, though. In particular, if Microsoft changes the existing default.aspx, my sites won't pick up the changes.

Is there any way I can make my module reference the existing default.aspx in the hive and still ghost it to my custom sites?

(I initially just tried using the XML from the original onet.xml in my module - as it does cause the file to be deployed from its original location in the hive - but the module errors because it doesn't contain the referenced file.)

2 Answers 2


Consider creating custom provisioning provider. Good example and explanation I found on codeproject. In your Provision method overload you can call apply blank template, afterward all files must be provisioned and you can safely add web parts to a default.aspx.
I think this approach best suited your requirements (if I'm not missed something).

  • I have come across this method and considered it; I baulked and moved on when I saw it required a webtemp*.xml file, which I thought we were trying to avoid. Looking at that Codeplex project, though, it seems solely to be used to tie the template to the provisioner, so I might have another look
    – Rawling
    Jan 26, 2012 at 13:19
  • Yep, using this approach this will be a site definition with separate webtemp*.xml Jan 26, 2012 at 13:43
  • ... but no onet, which kinda compensates for it. I'm just concerned by blogs.msdn.com/b/vesku/archive/2010/10/14/… which says "...is not recommended due future plans of SharePoint. Interface is not yet deprecated, but I' would not bet my business on this one, even though it might sound really compelling." But it does look like what I want.
    – Rawling
    Jan 26, 2012 at 13:59

The default page in a blank site definition just has some sample content? What exactly do you expect Microsoft to change in future that you would be concerned about? If you are deploying a new web template, you should control the deployment of the default page in your web template.

Your Answer

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

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