我在我的项目中创建了一个Web模板。我已经创建了一个功能,并添加了事件接收器,其中我已添加代码以创建自定义列表。现在我想将此功能添加到Web模板。我如何添加这个?我只是转到功能文件系统文件夹并复制Visual Studio SharePoint功能文件并粘贴到Web模板文件系统文件夹。是正确的方式吗?但我想知道,我还应该复制.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,

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.

许可以下: CC-BY-SA归因
scroll top