简体   繁体   中英

System.MissingMethodException in NInject

When running our unit tests on our TFS build server, we get this error:

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.

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)

Any ideas?

UPDATE: Ooops thought I mentioned this in the original message:

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. Eg Ninject 3.0.0 and Conventions 2.2.0

MissingMethod exception is a deployment problem. Use the Fusion log to check what is really loaded. Eg one assembly could be in the GAC.

OK, we figured it out.

TFS build server likes putting all DLLs in the same folder. This causes a problem if you have both .Net and Silverlight assemblies with the same name (such is the case with 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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