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 creating Timer Job in Sharepoint 2010. When I try to deploy the solution I get the following error :

Error occurred in deployment step 'Add Solution': Object reference not set to an instance of an object.

I am not able to figure out the cause of this error. Please help me. Thanks in advance.

share|improve this question
add comment

5 Answers 5

up vote 1 down vote accepted

As you wrote, the error occurs in the adding your solution. Are you trying to install a new timer job from your job definition in the feature event receiver?

If so, you could try the powershell way Remove the timer job installation code from your solution, but leave the job definition code.

Then in Powershell try to run this powershell code line for line and see what errors occur there:

[Reflection.Assembly]::LoadWithPartialName("your.solution.namespace")
$app = get-spwebapplication http://intranet
$name = "you-name-it-timer"
$job = new-object your.solution.namespace.MyTimerDefinition($name, $app)
$job.Schedule = [Microsoft.SharePoint.SPSchedule]::FromString("Every 15 minutes between 0 and 59")
$job.update()
#must restart timer service
restart-service sptimerv4
share|improve this answer
add comment

Try to implement the same same source code in a webpart and then debug to find the issue...

share|improve this answer
add comment

Can you try debugging the solution?

Add a using System.Diagnostics class in your timer job class and add a Debugger.break() statement in your code where you need to debug.

Deploy the timer job solution to the farm again. Restart the SharePoint Timer service, IIS Reset and when you run the timer job, there will be a debugger window poping up to select your visual studio solution. Select your solution and within few seconds, it will start debugging.

Good Luck.

share|improve this answer
add comment

What is the solution scope is it Web?, if it is it will throw you this error. Set the Scope to Site. And if this is not the case, most probably its the permission issue. Refer to this link. Hope this helps

share|improve this answer
    
the scope it Web Application. I have checked the permissions and they seem alright. –  Mansi Desai Mar 22 '12 at 8:30
    
For this kind of project you need to set the scope to Site. Please refer to this website dotnetfinder.wordpress.com/2010/07/24/… –  Agamand The True Mar 22 '12 at 10:11
    
thx a lot all of u for ur responses.... :)) –  Mansi Desai Mar 22 '12 at 11:53
    
Web Application scope should be fine; that's what I always use. –  Andy Burns Mar 22 '12 at 12:13
add comment

Right click Visual Studio-> Run as administartor

share|improve this answer
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.