Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am following this tutorial but for 2010 http://msdn.microsoft.com/en-us/library/cc406686%28office.12%29.aspx

I am in this part

How can I make a feature receiver in sp 2010?

Feature Receiver

Windows SharePoint Services 3.0 added the Feature framework, which provides SharePoint site developers and owners a way to inject functionality into existing sites and deploy custom solutions, such as workflow templates that are developed in Microsoft Visual Studio. Features can also be used for timer job deployment. Although the Feature schema does not provide a way to do this, the Feature Activated and Deactivating events can be caught with custom code to handle the installation and uninstallation of a timer job.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

In your Visual Studio 2010 solution, select the feature you want to have a receiver. Then right click the same and from the context menu, select event receivers. This will add another cs file in the feature structure/folder. This file has all the necessary events like FeatureActivated FeatureInstalled etc.. commented out initially. From there you can uncomment the desired event say FeatureActivated and write the code in there.

share|improve this answer
    
Thank you but I am a little confused. 1st. The timer job is a class library not a sharepoint project. so , Should I create a new vs 2010 solution with an empty sharepoint 2010 project, and then what? –  Luis Valencia Sep 16 '10 at 2:42
    
1. Yes create an empty SharePoint project. 2. Add all the classes to the solution except the one mentioned under Deploying Custom Timer Jobs->Feature Receiver you may need to update the namespace referred those classes. 3. Add a new feature to your Solution. 4. Follow the above steps to generate a feature receiver. 5. Copy the code from Custom Timer Jobs->Feature Receiver on MSDN to your feature receiver class. –  Vivek Sep 16 '10 at 3:31
    
It compiled, but when I press F5 to deploy I got this error. Error 1 Error occurred in deployment step 'Activate Features': Object reference not set to an instance of an object. 0 0 TimerSitoJob –  Luis Valencia Sep 18 '10 at 18:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.