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 into my project. I have created a feature and add event receiver where I have added code to create custom list. Now I want to add this feature to the web template. How I add this? I just go to feature file system folder and copied visual studio sharepoint feature file and pasted to web template file system folder. is that correct way? But I am wondering, should I also copied .xml and EventReceiver.cs files of feature? or only sharepoint feature file is enough ?

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

This article gives you step by step procedure for creating a full Web template. There is one step that also details how to add Features to the template http://blogs.msdn.com/b/vesku/archive/2010/10/14/sharepoint-2010-and-web-templates.aspx#associateion, as besides adding it as part of your project, you also need to specify it in the WebFeatures element or SiteFeatures according to its scope.

share|improve this answer
add comment

Yup in your element.xml file you can add following tag,

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <WebTemplate Name="SimpleSite" Title="Simple site" BaseTemplateID="1" BaseTemplateName="STS" BaseConfigurationID="0" DisplayCategory="Simple sites" />
</Elements>

Your project structure should look something like this,

enter image description here

I personally use WSP Builder which does the job for me, but if you don't know how to do it by yourself then I won't recommend yu using WSP builder straight away.

Here's tutorial for how to use WSP builder for creating a feature.

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.