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've realized recently that, when re-deploying (either manually or through vs2010) my timer job feature package, the updated execute code is not being deployed. Strange yea. Essentially, I'll deactivate all features,retract my package, change the exec code in vs2010, re-deploy, and the code won't be updated. The old timer code will run.

I found a fix though. If I change the assembly and file versions with each deployment, the changes get picked up. Anyone know why this is necessary?

share|improve this question

3 Answers 3

up vote 21 down vote accepted

You need to restart the SharePoint timer service (Start > Run > Services.msc). The timer jobs code get cached in the timer.

share|improve this answer
2  
Right on! Thanks. I added the commands to the lab/production deployment scripts. Also, in VS2010, I added net stop sptimerv4 net start sptimerv4 to the "Post Deployment Command Line Field" in Project -> Properties -> SharePoint. –  1c1cle Apr 8 '12 at 14:48
1  
Good idea on adding it to the deploy process in VS. –  John Chapman Apr 8 '12 at 18:07
    
The same applies to WSS/MOSS 2007. Forgot about restarting the timer service, thanks StackExchange! –  CigarDoug Feb 27 '13 at 15:35

The solution is to change your assembly and file version numbers: Project Properties -> Application -> Assembly Information...

share|improve this answer
    
Whoo, no, that should not be necessary to make it pick up your new code. –  Cameron Verhelst Mar 6 at 9:17
1  
a solution, not 'the solution'. –  1c1cle Mar 10 at 16:44

Just try to run this from the run dialogue

  1. net stop sptimerv4
  2. net start sptimerv4

this should do the trick.

share|improve this answer
2  
Or from PowerShell Restart-Service SPTimerV4 –  Per Jakobsen Apr 8 '12 at 7:32
    
@PerJakobsen You should add this as an answer! –  George Norberg Sep 17 at 12:50

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.