无法加载文件或程序集 IronPython Version=2.7.9.0

Could not load file or assembly IronPython Version=2.7.9.0

我在 运行 这个来自 https://github.com/bluephoton/najm 的项目时遇到了这个错误 之前已经有人问过这里 Could not load file or assembly IronPython 但到目前为止还没有答案! 我尝试安装不同版本的 IronPython 但没有成功。

这是错误信息:

    > System.IO.FileNotFoundException: Could not load file or assembly 'IronPython, Version=2.7.9.0, 
    Culture=neutral, PublicKeyToken=7f709c5b713576e1' or one of its dependencies. The system cannot find 
    the file specified.
    File name: 'IronPython, Version=2.7.9.0, Culture=neutral, PublicKeyToken=7f709c5b713576e1'
    at IPython.IronPythonHost.Load(String handlerModuleFile)
    at Najm.Handlers.HandlerAssembly.LoadAssembly(String assemblyName, String loadParam) in 
    F:\najm\Application\Handlers\HandlerAssembly.cs:line 63
    at Najm.Handlers.HandlerAssembly.Load(String location, String handlerAssembly, String loadParam) in 
    F:\najm\Application\Handlers\HandlerAssembly.cs:line 35
    at Najm.Handlers.HandlersManager.LoadHandler(HandlerInfo hi) in 
    F:\najm\Application\Handlers\HandlersManager.cs:line 51
    at Najm.Handlers.HandlersManager.LoadHandlers(IEnumerable`1 his) in 
    F:\najm\Application\Handlers\HandlersManager.cs:line 41
    at Najm.UI.MainAppForm.MainAppForm_Load(Object sender, EventArgs e) in 
    F:\najm\Application\UI\MainAppForm.cs:line 40
    at System.Windows.Forms.Form.OnLoad(EventArgs e)
    at System.Windows.Forms.Form.OnCreateControl()  
    at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
    at System.Windows.Forms.Control.CreateControl()
    at System.Windows.Forms.Control.WmShowWindow(Message& m)
    at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Pre-bind state information
LOG: DisplayName = IronPython, Version=2.7.9.0, Culture=neutral, PublicKeyToken=7f709c5b713576e1
 (Fully-specified)
LOG: Appbase = file:///F:/najm/Application/bin/x64/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : Najm.Handler.IPython, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: Using application configuration file: F:\najm\Application\bin\x64\Debug\Najm.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: IronPython, Version=2.7.9.0, Culture=neutral, PublicKeyToken=7f709c5b713576e1
LOG: Attempting download of new URL file:///F:/najm/Application/bin/x64/Debug/IronPython.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Build Number
LOG: Attempting download of new URL file:///F:/najm/Application/bin/x64/Debug/IronPython/IronPython.DLL.
LOG: Attempting download of new URL file:///F:/najm/Application/bin/x64/Debug/IronPython.EXE.
LOG: Attempting download of new URL file:///F:/najm/Application/bin/x64/Debug/IronPython/IronPython.EXE.
LOG: Attempting download of new URL file:///F:/najm/Application/bin/x64/Handlers/IPythonW/IronPython.DLL.
LOG: Attempting download of new URL file:///F:/najm/Application/bin/x64/Handlers/IPythonW/IronPython/IronPython.DLL.
LOG: Attempting download of new URL file:///F:/najm/Application/bin/x64/Handlers/IPythonW/IronPython.EXE.
LOG: Attempting download of new URL file:///F:/najm/Application/bin/x64/Handlers/IPythonW/IronPython/IronPython.EXE.

我终于解决了这个问题。 我联系了回购所有者,他让我编辑 Najm.config 首先我在“\najm\Application\Najm.config”中编辑了 Najm.config 我必须将 Loaction 属性设置为空字符串,现在我的 Najm.config 看起来像这样:

<?xml version="1.0"?>
<Najm>
<Handlers>
<!-- individual ids must match IDs you assign for your handler -->
<Handler Id="37581060-646F-49aa-8D1E-1E255B81B471" Location="" 
Assembly="Najm.Handler.Default.dll" Param="" IsEnabled="true"/>
<Handler Id="18E85847-29C2-4cb1-BDA5-0C971BFAB906" Location="" 
Assembly="Najm.Handler.Imaging.dll" Param="" IsEnabled="true"/>
<Handler Id="1E93F6DB-F2D2-4bda-A114-2B6F633859AC" Location="" 
Assembly="Najm.Handler.Tables.dll" Param="" IsEnabled="true"/>
<Handler Id="B705A42E-7671-4097-A366-6DC6534CCFF9" Location="" 
Assembly="Najm.Handler.IPython.dll" 
Param="..\Handlers\IPythonSamples\Console\Console.py" IsEnabled="true"/>
<Handler Id="5CB3C60C-CB36-4925-9C00-69771586F5B9" Location="" 
Assembly="Najm.Handler.IPython.dll" 
Param="..\Handlers\IPythonSamples\TableFields\TableFields.py" 
IsEnabled="true"/>
<Handler Id="871E9132-A1FF-410b-A897-5C72F003F7A4" Location="" 
Assembly="Najm.Handler.IPython.dll" 
Param="..\Handlers\IPythonSamples\Cube2GIF\cube2gif.py" IsEnabled="true"/>
</Handlers>
</Najm>

并将几个文件夹复制到其他位置,您可以在这里 https://github.com/bluephoton/najm/issues/4

然后我将(解决方案平台)从 x64 更改为 Any CPU 并解决了问题!