|
My understanding from asking a similar question recently is this:
Standard .Net/Mono and Silverlight differ in their core runtime assemblies as Silverlight is a more stripped down version. Anything you compile from "userspace" IronPython is going to be linked against .Net/Mono runtimes.
Thus, they won't run in Silverlight. The error you're getting about cannot load type is because it's looking for the .Net CLR Assembly Microsoft.Scripting.Core which isn't found in Silverlight/Chiron's runtime.
The answer is that you need to compile your assemblies for Silverlight.
From talking to jimmysch, the core developer of SDL-SDK, I got some leads and poked around. IronPython does NOT currently have the right internal code to do what needs to be done:
Compile the Python module to an Assembly, *SAVE THE ASSEMBLY TO ISOLATED STORAGE*, and download to the Browser.
Yes, the above seems... overboard but there is no bootstrapping available to compile against a different runtime set in IronPython.
The above is doable, I am working on adding a few additional code paths for Assembly compilation in IronPython, and building essentially a "Browser based compiler".
It's not ideal, but the best solution. I haven't had a lot of time to work on it in my end due to a similar issue as you (Working on developing a big application in IronPython which is eating up all my time, and the compiler is a "before it ships"
issue rather than a now issue), but if you look at http://sdlsdk.codeplex.com/Thread/View.aspx?ThreadId=52207 ; jimmysch and I were going back and forth about it.
Really all that needs to be done is adding a Assembly compilation path within IronPython to return a byte[] to userspace [currently it only allows you to save to the filesystem and Silverlight can't access normal FS anyway].
Another option I'm looking at is that Boo appears to have a command line compiler that's capable of spitting out precompiled Silverlight assemblies. Since Boo is also a DLR language, I'm mildly curious about whether I can steal some of it's code and
build a command line Silverlight compiler for Iron Python (But don't wait on me or you'll probably die of boredom or old age).
I will update this thread and the other if I find time to make things work. Would appreciate if anyone who figures it out would do the same ...
|