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?

1c1cle
  • 618
  • 4
  • 12

3 Answers3

26

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

John Chapman
  • 11,941
  • 6
  • 36
  • 62
  • 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 08 '12 at 14:48
  • 2
    Good idea on adding it to the deploy process in VS. – John Chapman Apr 08 '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
11

Just try to run this from the run dialogue

  1. net stop sptimerv4
  2. net start sptimerv4

this should do the trick.

Oyshik Moitra
  • 171
  • 1
  • 5
0

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