我可以在VS2010中将IronRuby项目编译成DLL/exe文件吗?
在使用 IronRuby v1.1.x 在 VS2010 中创建 IronRuby 项目后,我几乎可以通过导入它们来使用 .NET 库。但实际上无法将ironruby编译成exe/DLL。 我看到了构建选项,但无法从 IronRuby 项目构建任何 exe 或 DLL。
After created IronRuby project in VS2010 by using IronRuby v1.1.x, I was able to use almost .NET library by importing them. But can't actually compile ironruby into exe/DLL.
I see the build option but can't build any exe or DLL from IronRuby project.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
有一个很棒的 IronRuby gem,可以将 IronRuby 文件打包到 Windows 可执行文件中。
https://github.com/kumaryu/irpack
使用:
There's a great IronRuby gem that packages IronRuby files into a Windows executable.
https://github.com/kumaryu/irpack
To use:
您无法将 IronRuby 类编译为 .NET 程序集,然后从另一个程序集访问它们。
Preet 是对的,最接近的方法是将 IronRuby 脚本嵌入到(例如)C# 程序集中。从 C# 方面,就可以实例化您的 Ruby 类。因此,给出以下 Ruby 类:
您可以从资源文件加载它并从 C# 运行它:
You can't compile your IronRuby classes into a .NET assembly and then access them from another assembly.
Preet is right that the nearest you can get is to embed your IronRuby scripts in (say) a C# assembly. From the C# side it would then be possible to instantiate your Ruby classes. So given the following Ruby class:
You could load this from a resource file and run it from C#:
由于 Iron Ruby 只是基于 DLR 的代码。您应该能够将代码添加到任何程序集的资源中。最终您需要一个引导程序来加载代码。那很可能是一种 CLR 语言。
Since Iron Ruby is simply DLR based code. You should be able to add the code into a resource of any assembly. Ultimately you'll need a bootstrap to load the code. That will most likely be a CLR language.