I'm creating a Site Definition for SharePoint 2010 using VS 2010. Have some questions:
Your implementation approach (either declarative or programmatic) isn't indicated in your question so I am only assuming that you are building your custom site definition declaratively (with CAML). You will find that creating a custom site definition declaratively is pretty painful, especially when debugging. It usually involves making changes to the onet.xml file and just hoping things go right during deployment and/or site creation.
When developing custom site definitions, I find it easier to forgo the declarative mess and staple a custom feature to my custom site definition, allowing me to build the site up with code. Andrew Connell has a blog post to this effect:
http://www.andrewconnell.com/blog/archive/2008/02/15/You-dont-need-to-create-site-definitions.aspx
( Disclaimer : yeah, it's old, but still quite relevant, in my opinion)
Now that your tasks are programmatic (allowing you to debug, log errors, and generally have more visibility into the SharePoint magic) you can initialize your new SPWeb object as you see fit via the SharePoint object model.
Perhaps someone else can enumerate 100% declarative approach; I'm sure it's ugly, as is most CAML.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.