I am using this tutorial as example to create a timer job.
Here is my timer job code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint.Administration;
using Microsoft.SharePoint;
namespace CalcAnnualConsumptionTotals
{
public class GroupAnnualConsumption : SPJobDefinition
{
public GroupAnnualConsumption() : base() {} // <-- public default constructor
public GroupAnnualConsumption(string jobName, SPService service,
SPServer server, SPJobLockType lockType)
: base(jobName, service, server, lockType)
{
this.Title = "Group Annual Consumption";
}
public GroupAnnualConsumption(string jobName, SPWebApplication webapp)
: base(jobName, webapp, null, SPJobLockType.ContentDatabase)
{
this.Title = "Group Annual Consumption";
}
public override void Execute(Guid targetInstanceId)
{
.....
}
}
}
As you can see I have the default public constructor but when I try to deploy this it shows me error of:
Error occurred in deployment step 'Retract Solution': CalcAnnualConsumptionTotals.GroupAnnualConsumption cannot be deserialized because it does not have a public default constructor
When the first time I got this error I had actually forgotten to add default constructor. But even after adding it is showing me the error. I thought that my initial attempt would be partially successfull resulting in deployment. But I can't find it even via Central Administration or Get-SPTimerJob
.
Any ideas why this error is coming up.