Include scripting engine in your own application

Have you ever thought about including a scripting engine into your application? Maybe for advanced users, or just to be able to automate some things?

Goals of a scripting language

So what do you expect from an scripting engine?
First of all you want it to be simple but it should also be powerful.
Experienced users should get the chance of performing advanced tasks.

Most builtin scripting languages also provide their own command set, e.g. Read/Write application configuration without parsing any file.

Concerning we are developing in the .NET world this all cries for using a CLR Language as scripting language, but there remains one Problem:


How to achieve simplicity

Imagine someone just wants to output some lines to the console:

public class Test
  static void main(string[] args)

That's definitely not what i would call simple


What do we need to make this simpler?

My idea of solving this situation works as follows:

  1. Eliminate the need to write class and method definitions

    Just write:


    This will be automatically embedded into a class and method definition.

  2. Although provide the possibility to include user written methods and classes

    For simple tasks the overhead is minimized and more advanced users can still show what they can ;-)

  3. Provide the possibility to register custom methods and properties

    They are directly usable from the user script. See TestEnvironment of DevEck.ScriptingEngine

Check out the Scripting Engine and example application

I implemented the mentioned things and attached the library with a simple test projects. The test project accepts VB.Net code, but you can switch to C#. I currently use it in a highly database enabled application for automating SQL Queries.

If you like it, please leave me a comment

Update 14.01.2010:

  • I moved the source to github, browse to to see my other projects.
  • To clone the source do the following:
    [codeblock lang="" line="1"]git clone git://[/codeblock]
  • If you are not familiar with git have a look at