Schedular task

Mak Hattalli asked on July 15, 2015 21:10

Hi All,

I have created one custom class, but I am unable to add assembly name , I am getting error. I have mentioned Below code. Please help me.

using CMS.Scheduler; using CMS.EventLog;

namespace Custom : ITask { /// public class CustomTask { // my code here; } }

the above code I have added in app_code folder.

I am unable add below code

using CMS; Add the RegisterCustomClass assembly attribute above the class declaration (outside of the Custom namespace).

[assembly: RegisterCustomClass("Custom.CustomTask", typeof(Custom.CustomTask))]

Where I can add this code Please get me out from this.

Thanks in advance

Best Regards Mallikarjun Hattalli

Recent Answers


Brenden Kehren answered on July 15, 2015 21:27

Your code appears to be incorrect, you need to set your ITask implementation on the class name itself and not the namespace name.

[assembly: RegisterCustomClass("Custom.CustomTasks", typeof(Custom.CustomTasks))]
namespace Custom
{
    public class CustomTasks : ITask
    {
        public string Execute(TaskInfo ti)
        {
            // your work here
        }
    }
}
0 votesVote for this answer Mark as a Correct answer

Mak Hattalli answered on July 16, 2015 08:09

Hi Brenden Kehren ,

Thank you for replay.

I am new in kentico cms 8.0 , please can you tel me clearly, Where I can add that code.

using System; using System.Collections.Generic; using System.Linq; using System.Web; using CMS.Scheduler; using CMS.EventLog; using System.Net.Mail; using System.Net;

/// public class CustomTask : ITask { public CustomTask() { // // Here mine logic } }

Best Regards, Mallikarjun Hattalli

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on July 16, 2015 20:53

If you have a website vs. a web application then it will go in the /App_Code/

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.