views:

102

answers:

2

I would like to add some scripting support to a Silverlight 4 application that I'm working on. I have the latest stable releases of both IronRuby and IronPython installed on my machine with Visual Studio 2010. I looked at some samples of using the ScriptEngine class with both IronRuby and IronPython. I even got it to work in a small Windows Forms app to make sure my code works. However, I can't seem to Add Reference for the required Assemblies/DLLs to my Silverlight 4 application.

Here's my ScriptEngine code:

ScriptEngine engine = Ruby.CreateEngine();
engine.Runtime.Globals.SetVariable("MainPage", this);
string code = "MainPage.txtTitle.Text = \"Hello from IronRuby!\"";
engine.Execute(code);

And, here's my using statements that it requires:

using IronRuby;
using Microsoft.Scripting.Hosting;

When I try to Add Reference to the following Assemblies/DLLs from the IronRuby 1.0 release, Visual Studio 2010 doesn't let me add them and provides no exception message as to why. As a result I am unable to compile the solution.

IronRuby.dll
IronRuby.Libraries.dll
IronRuby.Libraries.YAML.dll
Microsoft.Dynamic.dll
Microsoft.Scripting.Debugging.dll
Microsoft.Scripting.dll

I assume that the reason Visual Studio 2010 isn't letting me add the Assemblies/DLLs is because they are compiled for .NET and not Silverlight.

Does anyone know where I can get Silverlight 4 versions of those assemblies or exactly what I'm doing incorrectly?

Any help would be appreciated. Thanks!

+2  A: 

The Silverlight versions for both IronRuby 1.0 and IronPython 1.0 are hidden in the IronRuby 1.0 for .NET 2.0 SP1 (Zip archive) downloadable from http://ironruby.codeplex.com/releases. In the zip look for silverlight\bin.

The IronRuby 1.1 Silverlight release is also available. IronPython 1.1 for Silverlight however is nowhere to be found. The DLR isn't getting the love from Microsoft it deserves, little documentation, binaries are very hard to find, the future for IronRuby and IronPython doesn't look bright...

Koen Zwikstra
Thank you very much for pointing me to this!!
Chris Pietschmann
+2  A: 

Just a note to Koen's answer:

The IronPython\Silverlight\bin .dlls from IronPython 2.6.x are .NET 3.5 binaries (work fine in Silverlight 4). The .NET 4 binaries for Silverlight 4 will be available with IronPython 2.7 (currently in alpha).

Lukas Cenovsky