22

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?

3 Answers 3

26

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

3
  • 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
    Commented Apr 8, 2012 at 14:48
  • 2
    Good idea on adding it to the deploy process in VS. Commented Apr 8, 2012 at 18:07
  • The same applies to WSS/MOSS 2007. Forgot about restarting the timer service, thanks StackExchange!
    – CigarDoug
    Commented Feb 27, 2013 at 15:35
11

Just try to run this from the run dialogue

  1. net stop sptimerv4
  2. net start sptimerv4

this should do the trick.

2
  • 2
    Or from PowerShell Restart-Service SPTimerV4 Commented Apr 8, 2012 at 7:32
  • @PerJakobsen You should add this as an answer! Commented Sep 17, 2014 at 12:50
0

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

2
  • Whoo, no, that should not be necessary to make it pick up your new code. Commented Mar 6, 2014 at 9:17
  • 1
    a solution, not 'the solution'.
    – 1c1cle
    Commented Mar 10, 2014 at 16:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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