开发者

WPF App hosting/executing Ruby code via IronRuby

Hey folks, hoping 开发者_StackOverflow社区you can help me get started with IronRuby. I have several Ruby scripts that I want to execute from my WPF Application (due to the use of several RMagick methods I can't get natively) and I can't find any good info on what references I need in the project.

I've installed IronRuby and tried adding Microsoft.Scripting and .Core but the app complains that I have no Sub Main method - can IronRuby be used in a non-console app?

Thanks, Becky


Of course it can be used in a non-console app! that's what it all about :)

You need to add references to IronRuby.dll, IronRuby.Libraries.dll, Microsoft.Scripting.dll and Microsoft.Scripting.Core.dll.

Then you have multiple ways to execute IronRuby code or files like IronRuby.GetEngine().Execute("puts 'hello world'") or IronRuby.GetEngine().ExecuteFile("iron_ruby_file.rb").

Look at the next resources for more info about how to execute IronRuby code from C# code:

  • http://ironshay.com/post/make-your-application-extendable-using-the-dlr.aspx
  • http://www.youtube.com/watch?v=P7DyIU3wzdY
  • http://www.ironruby.net - good resource in general but doesn't have lots of information for what you need currently.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜