DLR Hosting Sample : Simple dlr host using the new App.Config based ScriptRuntime creation
Due to the recent changes to the DLR Hosting API, dlr hosts now have to use the App.Config file to configure the languages they intend to use in the application. It’s probably a little bit more complex than before to get started on Hosting the DLR after this change.
The attached self contained sample(for VS 2008) addresses this and tries to make it easier to ‘get started’. The sample is a very simple console application that -
1) Hosts the dlr
2) Uses the ScriptRuntimeSetup.ReadConfiguration() and the ScriptRuntime constructor to create the runtime based on the entries in the App.Config file
3) Creates 2 language engines – one for IronPython and 1 for IronRuby
4) Creates a variable in IronPython and prints the value in C#.
The sample contains a pre configured App.Config file. You should be able to just extract the files locally and build the sample and execute it. The dlr and language binaries are also included (in the ‘lib’ folder). Note that these post IronPython V2 beta4 binaries are for demo purposes only and come with no warranty or support.
Comments
Anonymous
September 11, 2008
When I try to extract and run the sample, it throws a "strong name validation fails for Microsoft Scripting" type of exception.Anonymous
September 12, 2008
Florian, The scripting runtime binaries attached with this sample are unsigned. Since this sample comes 'as-is' I didn't sign these binaries. I think your system's security policies may be preventing this binary from running. Could you please check if thats the case? The latest source update in the codeplex.comIronPython site will compile to produce binaries of the same version as the attached ones. So, if that has worked for you in the past, could you try building your own binaries and adding them as reference? Please let me know if neither works for you.Anonymous
September 14, 2008
This previous post demonstrates the use of App.Config files to create script runtimes to host dynamicAnonymous
September 17, 2008
I tried it with VS 2008 on Vista and on XP and I don't have any custom policies enabled. Running as admin on XP. I have Silverlight 2b2 installed, if that matters. I can compile and run IronPython, but it doesn't give me the Microsoft.Scripting dlls that fail.Anonymous
September 19, 2008
Hi Florian, If you are able to compile and run ironpython, you can add references to the binaries from that project instead of the ones I put in the zip file. Note that, you have to get IronPython V2 beta5 to get the sources for the dlls. The V1 of IronPython doesn't ship with a separate systemcore dll. Here is the beta5 version - http://www.codeplex.com/IronPython/Release/ProjectReleases.aspx?ReleaseId=15625 Hope this helps. (If this also doesn't help, the next step would be run Filemon or procmon.exe from http://live.sysinternals.com and see if the correct dlls are being loaded.)