So fügen Sie die Funktion zur Webvorlage hinzu
-
10-12-2019 - |
Frage
Ich habe eine Webvorlage in mein Projekt erstellt.Ich habe eine Funktion erstellt und einen Ereignisempfänger hinzufügen, in dem ich Code hinzugefügt habe, um die benutzerdefinierte Liste zu erstellen.Jetzt möchte ich diese Funktion in der Webvorlage hinzufügen.Wie füge ich das hinzu?Ich gehe einfach, um den Ordner des Dateisystems zu feilen und visuelle Studio SharePoint-Feature-Datei kopierte und in den Ordner des Web-Template-Dateisystems eingefügt.ist das richtig?Aber ich frage mich, sollte ich auch .xml- und eventreceureceiver.cs-Dateien von Funktionen kopieren?Oder nur die SharePoint-Feature-Datei reicht aus?
Lösung
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.
Andere Tipps
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.