简体   繁体   English

NInject中的System.MissingMethodException

[英]System.MissingMethodException in NInject

When running our unit tests on our TFS build server, we get this error: 在我们的TFS构建服务器上运行单元测试时,我们收到此错误:

SetUp : System.MissingMethodException : Method not found: 'Void
Ninject.ModuleLoadExtensions.Load(Ninject.IKernel, System.Reflection.Assembly[])'.
at Ninject.Extensions.Conventions.AssemblyScanner.Process(
Assembly assembly, IKernel kernel)

which, as far as I can tell, is saying that one part of NInject can't find another part of Ninject. 据我所知,正在说NInject的一部分找不到Ninject的另一部分。

The problem occurs on all three of our build servers. 我们所有三个构建服务器都会出现此问题。

Locally, it works fine. 在本地,它工作正常。

All systems (local & remote) appear to be using the correct version of all the Ninject assemblies (as well as all the other in the application) 所有系统(本地和远程)似乎都使用了所有Ninject程序集的正确版本(以及应用程序中的所有其他程序)

Any ideas? 有任何想法吗?

UPDATE: Ooops thought I mentioned this in the original message: 更新:Ooops认为我在原始消息中提到了这一点:

Ninject ver 2.2.0.0
Ninject.Extensions.Conventions  ver 2.2.0.5

Moste likely you use different versions of Ninject.dll and Nnject.Extensions.Conventions. Moste可能使用不同版本的Ninject.dll和Nnject.Extensions.Conventions。 Eg Ninject 3.0.0 and Conventions 2.2.0 例如Ninject 3.0.0和约定2.2.0

MissingMethod exception is a deployment problem. MissingMethod异常是部署问题。 Use the Fusion log to check what is really loaded. 使用Fusion日志检查实际加载的内容。 Eg one assembly could be in the GAC. 例如,一个组件可能在GAC中。

OK, we figured it out. 好的,我们弄清楚了。

TFS build server likes putting all DLLs in the same folder. TFS构建服务器喜欢将所有DLL放在同一个文件夹中。 This causes a problem if you have both .Net and Silverlight assemblies with the same name (such is the case with Ninject.dll) 如果同时具有相同名称的.Net和Silverlight程序集(例如Ninject.dll的情况),则会导致问题

The solution was to change the "Output Path" on the Silverlight projects' properties page (under the "Build" tab), from the standard " bin\\Release\\ " to something like " bin\\Release\\Silverlight " so the DLLs are kept separate. 解决方案是将Silverlight项目的属性页面(在“构建”选项卡下)中的“输出路径”从标准“ bin\\Release\\ ”更改为类似“ bin\\Release\\Silverlight ”的内容,以便保留DLL分离。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM