2011-03-17 59 views
4

當我參考最新版本的Microsoft.Scripting(IronPython附帶的一個)時,我在Visual Studio中收到警告。是否可以在同一個應用程序中並排使用IronPython和IronRuby?

是否可以在同一應用程序中並排部署/使用它們? 是否有更好/更動態的方式來實例化運行時?

private ScriptRuntime GetScriptRuntime() 
{ 
    if ("IronRuby".Equals(scriptUnit.Type)) 
    { 
     return IronRuby.Ruby.CreateRuntime(); 
    } 
    if ("IronPython".Equals(scriptUnit.Type)) 
    { 
     return IronPython.Hosting.Python.CreateRuntime(); 
    } 
    throw new Exception("Unknown Script Type [" + scriptUnit.Type + "]"); 
} 

Image of Warning in Visual Studio

Text of Warning - Module 'Microsoft.Scripting, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' should be referenced. 
+0

你有沒有嘗試將它們分成不同的項目(一個for ironruby和另一個for ironpython),然後引用你的主項目?或者,如果您只打算使用一個(取決於輸入),那麼只需在運行時動態加載程序集。 – 2011-03-17 20:34:47

+0

似乎就像http://stackoverflow.com/questions/5238989/embedding-both-ironruby-and-ironpython – 2011-03-17 22:00:16

回答

3

這是可能的,你只需要找到那都建有相同的核心的.dll或yourserf建立兩個版本。

+1

特別是,IronPython 2.7和IronRuby 1.1.3是兼容的。 – 2011-03-18 14:31:53

+0

IronPython 2.7.1和IronRuby 1.1.3似乎是兼容的,但IronPython 2.7.2和更高版本不兼容。 – jordanbtucker 2012-08-02 02:38:02

相關問題