0

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?

2
  • 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.
    – Ralph W
    Nov 29, 2012 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. Nov 29, 2012 at 22:49

1 Answer 1

0

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.

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.