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 a timer job which was deploying and working without any problems.

I then created a second job in the same feature and had some problems deploying it, but after restarting Visual Studio this deployed correctly.

Now though, both jobs are failing when they are executed as the Guid that is being passed to the execute methods seems to be wrong. There is only one DB and the Guid that is being passed is incorrect.

Can anybody tell me why the GUID may be incorrect?

share|improve this question

1 Answer 1

the best approach is to create each SharePoint timer job in a separate feature.xml. In each feature.xml you can specify the scope of the job, unique id, and receiver class for the job. Here are two sample feature.xml that you may need to get an idea. Of course, you can package both these features in the same Class Library -> then to WSP.

<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/"
         Id="1DB91AA4-C699-4499-B1BD-67583ABB1EE2"
         Title="job 1"
         Description="job 1 description."
         Scope="Site"
         Hidden="TRUE"
         Version="1.0.0.0"
         ReceiverAssembly="Myassembly.Platform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f5afeac9a8e5e1b0"
         ReceiverClass="Myassembly.Platform.Job_1_Installer">    
</Feature>



<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/"
         Id="20D74316-6E1F-4582-9F27-FC729E231956"
         Title="My job 2"
         Description="job 2 description"
         Scope="Site"
         Hidden="TRUE"
         Version="1.0.0.0"
         ReceiverAssembly="Myassembly.Platform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f5afeac9a8e5e1b0"
         ReceiverClass="Myassembly.Platform.Job_2_Installer">

 <Properties>
    <Property Key="BeginMinutes" Value="5;10;15;20;25;30;35;40;45;50;55" />      
  </Properties>
</Feature>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.