#1, Create solution structure
#2: feature.xml
<Feature
Id="86689158-7048-4421-AD21-E0DEF0D67C81"
Title="Wingtip Lead Tracker"
Description="A sample feature deployed using LocalhostDevProject1.wsp"
Version="1.0.0.0"
Scope="Web"
Hidden="FALSE"
ReceiverAssembly="LocalhostDevProject1, [four-part assembly name, use refector to get]"
ReceiverClass="LocalhostDevProject1.FeatureReceiver"
ImageUrl="LocalhostDevProject1/FeatureIcon.gif"
xmlns="http://schemas.microsoft.com/sharepoint/" >
<ElementManifests>
<ElementManifest Location="elements.xml"/>
</ElementManifests>
</Feature>
Id="86689158-7048-4421-AD21-E0DEF0D67C81"
Title="Wingtip Lead Tracker"
Description="A sample feature deployed using LocalhostDevProject1.wsp"
Version="1.0.0.0"
Scope="Web"
Hidden="FALSE"
ReceiverAssembly="LocalhostDevProject1, [four-part assembly name, use refector to get]"
ReceiverClass="LocalhostDevProject1.FeatureReceiver"
ImageUrl="LocalhostDevProject1/FeatureIcon.gif"
xmlns="http://schemas.microsoft.com/sharepoint/" >
<ElementManifests>
<ElementManifest Location="elements.xml"/>
</ElementManifests>
</Feature>
#3, elements.xml
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ListInstance
FeatureId="00BFEA71-7E6D-4186-9BA8-C047AC750105"
TemplateType="105"
Id="SalesLeads"
Title="Sales Leads"
Url="SalsLeads"
OnQuickLaunch="true"/>
</Elements>
<ListInstance
FeatureId="00BFEA71-7E6D-4186-9BA8-C047AC750105"
TemplateType="105"
Id="SalesLeads"
Title="Sales Leads"
Url="SalsLeads"
OnQuickLaunch="true"/>
</Elements>
#4, FeatureReceiver.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
namespace LocalhostDevProject1
{
public class FeatureReceiver : SPFeatureReceiver
{
public override void FeatureActivated(SPFeatureReceiverProperties props)
{
SPWeb site = props.Feature.Parent as SPWeb;
if (site != null) {
site.Title = "Feature Activated";
site.SiteLogoUrl = @"_layouts/images/LocalhostDevProject1/SiteIcon.gif";
site.Update();
}
}
public override void FeatureDeactivating(SPFeatureReceiverProperties props)
{
SPWeb site = props.Feature.Parent as SPWeb;
if (site != null)
{
site.Title = "Feature Deactivated";
site.SiteLogoUrl = "";
site.Update();
SPList list = site.Lists.TryGetList("Sales Leads");
if (list != null)
{
list.Delete();
}
}
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
namespace LocalhostDevProject1
{
public class FeatureReceiver : SPFeatureReceiver
{
public override void FeatureActivated(SPFeatureReceiverProperties props)
{
SPWeb site = props.Feature.Parent as SPWeb;
if (site != null) {
site.Title = "Feature Activated";
site.SiteLogoUrl = @"_layouts/images/LocalhostDevProject1/SiteIcon.gif";
site.Update();
}
}
public override void FeatureDeactivating(SPFeatureReceiverProperties props)
{
SPWeb site = props.Feature.Parent as SPWeb;
if (site != null)
{
site.Title = "Feature Deactivated";
site.SiteLogoUrl = "";
site.Update();
SPList list = site.Lists.TryGetList("Sales Leads");
if (list != null)
{
list.Delete();
}
}
}
}
}
#5, manifest.xml
<Solution xmlns="http://schemas.microsoft.com/sharepoint/"
SolutionId="0cee8f44-4892-4a01-b8f4-b07aa21e1ef2"
Title="Localhost Dev Project 1"
DeploymentServerType="WebFrontEnd"
ResetWebServer="true">
<FeatureManifests>
<FeatureManifest Location="LocalhostDevProject1\feature.xml"/>
</FeatureManifests>
<TemplateFiles>
<TemplateFile Location="IMAGES\LocalhostDevProject1\FeatureIcon.gif"/>
<TemplateFile Location="IMAGES\LocalhostDevProject1\SiteIcon.gif"/>
</TemplateFiles>
<Assemblies>
<Assembly Location="LocalhostDevProject1.dll" DeploymentTarget="GlobalAssemblyCache"/>
</Assemblies>
<ActivationDependencies>
<ActivationDependency SolutionId="" SolutionName=""/>
</ActivationDependencies>
</Solution>
SolutionId="0cee8f44-4892-4a01-b8f4-b07aa21e1ef2"
Title="Localhost Dev Project 1"
DeploymentServerType="WebFrontEnd"
ResetWebServer="true">
<FeatureManifests>
<FeatureManifest Location="LocalhostDevProject1\feature.xml"/>
</FeatureManifests>
<TemplateFiles>
<TemplateFile Location="IMAGES\LocalhostDevProject1\FeatureIcon.gif"/>
<TemplateFile Location="IMAGES\LocalhostDevProject1\SiteIcon.gif"/>
</TemplateFiles>
<Assemblies>
<Assembly Location="LocalhostDevProject1.dll" DeploymentTarget="GlobalAssemblyCache"/>
</Assemblies>
<ActivationDependencies>
<ActivationDependency SolutionId="" SolutionName=""/>
</ActivationDependencies>
</Solution>