웹 템플릿에 기능을 추가하는 방법
-
10-12-2019 - |
문제
웹 템플릿을 프로젝트에 만들었습니다.필자는 기능을 만들고 사용자 정의 목록을 만드는 코드를 추가 한 이벤트 수신기를 추가했습니다.이제 웹 템플릿 에이 기능을 추가하고 싶습니다.내가 어떻게 추가 했는가?방금 Feature File System 폴더로 이동하여 Visual Studio SharePoint 기능 파일을 복사하고 Web Template File System 폴더에 붙여 넣습니다.그게 정확한 방법인가?그러나 .xml 및 eventreceiver.cs 파일을 복사해야합니다.또는 SharePoint 기능 파일 만 충분합니까?
해결책
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.
다른 팁
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,
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.