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 have created a web template using visual studio 2010, it has two features.

Feature1 - Contains WebTemplate element (scoped site) Feature2 - Contains List Definitions (scoped web)

I package, upload and activate the wsp file to the solution gallery.

I the click 'Site Action' > 'Create New Site'. I choose my custom site (as defined in the web template) and click Create. This causes an error (I get a generic error with some GUID).

Workaround - If i go into the Site Features and activate Feature2 and the do the above step everything works fine (i dont want to do this because all lists are created in the root).

Why is this?

share|improve this question
    
I would create a webprovisioned event receiver and activate the features in code. I think it may have something to do with activating a site collection scoped feature from web template (onet.xml) which is not allowed (if I remember correctly). We've had similar issues with web templates and resort to activating features through code. Custom site definitions however do work but are now not recommended anymore. –  Grooverinthesouth Nov 29 '12 at 16:57
    
yes, you can activate a Site-scoped feature in the ONET, even in a sandbox solution. Even so, the OP's Feature2 is web-scoped. –  Derek Gusoff Nov 29 '12 at 22:49
add comment

1 Answer 1

up vote 0 down vote accepted

You have dependencies that are out of whack. Something in your web template feature is dependent on something in your lists feature. You might be able to figure out what it is by looking at the package file in your project. Do you see any items that are deployed in the wrong order? Common gotchas include: provisioning a file to a library in a module before the library has been created, and trying to create a list on a content type before the content type has been provisioned.

share|improve this answer
add comment

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.