Pregunta

I'm using ninject xml extension to congire different DAL's for the same executable (plugins). My idea was to put all of them (DLLs) in a subfolder of the main application with the ninject xml files.

The problem is that ninject cannot find the referenced binding in the xml. It works only if i copy the dlls to the same folder of the main application (.exe).

I tried to load the dlls before loading the kernel

Assembly assembly = Assembly.LoadFrom(dll);
AppDomain.CurrentDomain.Load(assembly.GetName());
Kernel.Load(xmlFile);

But still doesnt work. (Error: "Couldnt resolve type 'MyType' defined in 'to' attribute")

Does anybody know some way to refer a concrete folder at the ninject-xml file or loading types from another folder that can be resolved using ninject-xml extension?

¿Fue útil?

Solución 2

I solve this usign the "probing" element at the config file. It includes a folder at the resolution scope.

<runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <probing privatePath="Plugins"/>
      </assemblyBinding>
 </runtime>

More info here.

Thanks to all.

Otros consejos

Would the conventions extension perhaps solve the problem by loading your bindings based on what DLLs are present? If not, can you please explain your problem with some more detail?

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top