So you want to develop a custom timer job for SharePoint 2010. You looked around in several books and searched some websites.
Ypou created a custom timer job, you deploy it and it seems to be working. However, everytime you adjust the code, no mather what, the old code is run.
You did keep all rules in mind, regarding to building custom timer jobs.
You declared a featuredeactivating, you retreacted the solution.
Still, the original code is run …
The magic behind this is, that although you deactivate and retract the code, the code is still present on the SharePoint server UNTIL you restart the timer job !
So best thing to accomplish a healthy environment for building custom timer jobs is to add 2 pre-build commands.
Open the configuration of your project and add the following 2 rules as a pre-build command
net stop sptimerv4
net start sptimerv4
Now debug your solution again and see that the new code is run !