Skip to main content

Cloud

Setup a Visual Studio project for easier SharePoint Feature development

Problem

You want to use Visual Studio to develop and deploy your SharePoint feature.

Solution

1.) Create a class library project in Visual Studio.NET

2.) Delete the Class1.cs file because you will not need it for feature development

3.) Right-click on the references folder and select add reference. In the add reference dialog box, add a reference to System.Web to the project. This step is necessary if you plan to develop master pages, or page layouts as a part of your feature.

4.) Create a 12 Hive structure in your project. Right-click on the project and add a folder named 12. Continue to add folders below the 12 Hive until you have the TEMPLATE and FEATURES folders. Finally, add a folder in FEATURES that will hold your feature.

5.) Add the Feature.xml and Elements.xml files to define a basic feature.

6.) Right-click on your project and select Properties. Add post-build events that will copy the 12 Hive in your project into the 12 Hive on your target SharePoint server, install and activate your feature, and recycle your IIS server.

Add these commands to the post-build event command line:

cd "$(ProjectDir)"
xcopy "12" "%CommonProgramFiles%Microsoft Sharedweb server extensions12" /ys
cd "C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12BIN"
stsadm -o installfeature -name SampleFeature -force
stsadm -o activatefeature -filename samplefeaturefeature.xml -url http://urlofsite
%systemroot%system32iisapp.vbs /a "Name_Of_Pool" /r

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Dave Scheele

More from this Author

Follow Us
TwitterLinkedinFacebookYoutubeInstagram