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 have created & deployed a custom Jobdefinition via feature activation. During feature deactivation I use...

 Foreach(SPJobDefinition job in WebApp.JobDefinitions){
           If(job.Name.Contains("myJobName")){
                  job.Delete();
           }
  }
 WebApp.update()

I then checked with PoweShell and the definition was gone. I retract my solution. Then in PowerspShell

 Restart-service sptimerv4
 Iisreset
 Restart-service sptimerv4

Re-deploy my solution/activate feature. And again in PowerShell

  $tj = get-sptimerjob "myJobName"
   $tj.myMethod()
  >>Error no method found

Then I deployed the same build for the first time on another server & it worked great. How do I get the timerjob to properly update on the first server?

share|improve this question
add comment

1 Answer 1

When it comes to custom Timer jobs deployment, I always retract and remove deployed timer job first. Then restart Windows Timer service from services.msc and then add solution again to solution store using STSADM followed by STSADM deployment statement.

Now I wait for a while like few minutes and then run this command on all of WFEs to make sure solution is deployed,

stsadm -o execadmsvcjobs 

Source

Once I am sure that solution is deployed, I activate the feature. I am not sure if it's best practice or not but it worked perfectly for me.

Back in days I used to simply use STSADM upgrade command but it didn't used to work efficiently for me and solution wasn't actually getting updated for some reason.

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.