Is there any CLR based scripting language that would run on .NET 2.0?


#1

We need to support very old legacy computers that has .NET 2.0 installed only. I’m looking for a scripting language to embed into the application, is there any good one that would run on .NET 2.0? Preferably supported to this day, and written in pure C# without pinvoke. Any suggestions?


#2

Why not just use C# as the scripting lang. Then have your host app compile it into a .dll using the “CSharpCodeProvider” object… that in turn the host app loads/unloads and invokes. That way this “scripting” system could reference and manipulate objects in the host app with minimal effort.

This works in .NET 2.0: https://msdn.microsoft.com/en-us/library/microsoft.csharp.csharpcodeprovider(v=vs.110).aspx

HowTo ref: https://support.microsoft.com/en-us/help/304655/how-to-programmatically-compile-code-using-c-compiler


#3

Well, this is an alternative. The only downside is how CSharpCodeProvider works: it actually dumps the source code to a temp folder, run the compiler in hidden window and loads the result of compilation. It is a bit ugly, but yes, it works.


.NET Foundation Website | Blog | Projects | Code of Conduct