Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.)

share|improve this question

2 Answers 2

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.

share|improve this answer

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).

share|improve this answer
    
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 '12 at 13:19
    
Yep, using this approach this will be a site definition with separate webtemp*.xml –  Kai Jan 26 '12 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 '12 at 13:59

Your Answer

 
discard

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.