Build SharePoint Feature to Deploy File System Changes
With SharePoint solution packages, it’s possible to port the file system changes and providing Feature-based solutions! Let us build a SharePoint 2007 feature to deploy file system changes (12 hive files) using WSP Builder. Here are the steps:
1. Create a new WSP project ( you need to have WSP Builder installed. If not, get it from CodePlex)
2. Add a New Item
3. Add a New Feature with Receiver code.
2. Add the code in Feature Receiver, Say for e.g. I’m replacing an image in 12 hive, I’ve written the following code.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
using System.IO;
namespace FileSystemChangesFeature
{
   class FileSystemChangesFeature : SPFeatureReceiver
   {
   public override void FeatureActivated(SPFeatureReceiverProperties properties)
       {
           //Backup the Original Image NORESULT.gif and Replace with the New image from Features Directory
      if (File.Exists("C:\\Program Files\\Common Files\\Microsoft Shared\\web server extensions\\12\\TEMPLATE\\LAYOUTS\\1033\\IMAGES\\NORESULT.GIF"))
           {
              File.Move("C:\\Program Files\\Common Files\\Microsoft Shared\\web server extensions\\12\\TEMPLATE\\LAYOUTS\\1033\\IMAGES\\NORESULT.GIF","C:\\Program Files\\Common Files\\Microsoft Shared\\web server extensions\\12\\TEMPLATE\\LAYOUTS\\1033\\IMAGES\\NORESULT.GIF.BAK");
               File.Copy("C:\\Program Files\\Common Files\\Microsoft Shared\\web server extensions\\12\\TEMPLATE\\FEATURES\\FileSystemChangesFeature\\NORESULT.GIF", "C:\\Program Files\\Common Files\\Microsoft Shared\\web server extensions\\12\\TEMPLATE\\LAYOUTS\\1033\\IMAGES\\NORESULT.GIF");
           }
       }
       public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
       {
           if (File.Exists("C:\\Program Files\\Common Files\\Microsoft Shared\\web server extensions\\12\\TEMPLATE\\LAYOUTS\\1033\\IMAGES\\NORESULT.GIF"))
           {
               File.Delete("C:\\Program Files\\Common Files\\Microsoft Shared\\web server extensions\\12\\TEMPLATE\\LAYOUTS\\1033\\IMAGES\\NORESULT.GIF");
               File.Copy("C:\\Program Files\\Common Files\\Microsoft Shared\\web server extensions\\12\\TEMPLATE\\LAYOUTS\\1033\\IMAGES\\NORESULT.GIF.BAK", "C:\\Program Files\\Common Files\\Microsoft Shared\\web server extensions\\12\\TEMPLATE\\LAYOUTS\\1033\\IMAGES\\NORESULT.GIF");
           }
       }
       public override void FeatureInstalled(SPFeatureReceiverProperties properties)
       {
           //throw new Exception("The method or operation is not implemented.");
       }
       public override void FeatureUninstalling(SPFeatureReceiverProperties properties)
       {
           // throw new Exception("The method or operation is not implemented.");
       }
     }
}
what is the aim of this tips ?
More screen print to imagine