Silverlight 4 应用程序中的 DLR 脚本

发布于 2024-09-25 02:16:58 字数 1031 浏览 7 评论 0原文

我想向我正在开发的 Silverlight 4 应用程序添加一些脚本支持。我在我的计算机上安装了 Visual Studio 2010 的 IronRuby 和 IronPython 的最新稳定版本。我查看了一些将 ScriptEngine 类与 IronRuby 和 IronPython 一起使用的示例。我什至让它在一个小型 Windows 窗体应用程序中运行,以确保我的代码可以正常运行。但是,我似乎无法将所需程序集/DLL 的引用添加到我的 Silverlight 4 应用程序中。

这是我的 ScriptEngine 代码:

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

并且,这是我需要的 using 语句:

using IronRuby;
using Microsoft.Scripting.Hosting;

当我尝试添加对 IronRuby 1.0 版本中的以下程序集/DLL 的引用时,Visual Studio 2010 不允许我添加它们,并且不提供任何异常消息为什么。结果我无法编译解决方案。

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

我认为 Visual Studio 2010 不允许我添加程序集/DLL 的原因是它们是针对 .NET 而不是 Silverlight 编译的。

有谁知道我可以在哪里获得这些程序集的 Silverlight 4 版本或者到底我做错了什么?

任何帮助将不胜感激。谢谢!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

凉城凉梦凉人心 2024-10-02 02:16:58

IronRuby 1.0 和 IronPython 1.0 的 Silverlight 版本隐藏在 IronRuby 1.0 for .NET 2.0 SP1(Zip 存档)中,可从 下载http://ironruby.codeplex.com/releases。在 zip 中查找 silverlight\bin。

IronRuby 1.1 Silverlight 版本也已发布。然而,Silverlight 的 IronPython 1.1 却无处可寻。 DLR 没有得到 Microsoft 应有的喜爱,文档很少,二进制文件很难找到,IronRuby 和 IronPython 的未来看起来并不光明......

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...

夜深人未静 2024-10-02 02:16:58

请注意 Koen 的回答:

IronPython 2.6.x 中的 IronPython\Silverlight\bin .dll 是 .NET 3.5 二进制文件(在 Silverlight 4 中工作正常)。 Silverlight 4 的 .NET 4 二进制文件将在 IronPython 2.7 中提供(当前为 alpha) 。

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).

早乙女 2024-10-02 02:16:58

我一直在寻找某种与 Silverlight 兼容的脚本引擎,经过几个小时的研究,我找到了一个。我还没有测试过,但我刚刚发现了一个名为 PaxScript.net 的项目,它支持 Silverlight 3/4/5。据作者介绍,您可以使用 VB.NET、C# 和 Delphi.NET 编写脚本。它确实生成字节码。我不知道为什么这个项目不为人所知,也许是缺乏“披露”。

I was looking for some kind of scripting engine compatible with Silverlight, and after hours of research, I've found one. I had not tested yet but I just discovered a project called PaxScript.net that has support for Silverlight 3/4/5. According to the author, you can script using VB.NET, C# and Delphi.NET. It does generate byte-code. I don't know why this project is not known, maybe lack of "disclosure".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文