Table of Contents | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Creating Job Scheduler API Jobs using C# and .NET
In addition to the programming languages natively supported by the JobScheduler API, JobScheduler can call COM Objects with access on its API.
This technique can be used to create C# jobs.
Setting up a project in Visual Studio
- Create a new project of type "Class Library"
- Choose .NET Framework 4 or higher
- In the project properties go to Application->Assembly Information and check "Make assembly COM-Visible"
- In the project properties go to Build and check "Register for COM interop"
- In the project properties go to Signing and check "Sign the assembly"
- Create a Class to implement the job
- Run Visual Studio as Administrator to enable it to register the assembly on your machine
Implementing the job
JobScheduler will later try to find the com class as "namespace.classname". This combined name may not be longer than 40 characters.
...
The example Visual Studio Project can be downloaded here: http://www.sos-berlin.com/download/scheduler/CSharpSampleJob.zip
Running the job
In JobScheduler the job for the above example is configured as follows:
No Format |
---|
<?xml version="1.0" encoding="ISO-8859-1"?> <job> <params> <param name="test" value"12345"/> </params> <script com_class="CSharpSampleJob.SampleJob"/> </job> |
Registering the assembly
In order for JobScheduler to find your COM Class, the assembly needs to be registered.
...
Code Block |
---|
C:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe CSharpSampleJob.dll /codebase |
Debugging the job
In order to debug the job in visual studio
...