Quantcast
Channel: patterns & practices: Prism
Viewing all articles
Browse latest Browse all 1878

Created Unassigned: Finding modules in App.config depends on currently active directory [10713]

$
0
0
I am trying to use PRISM 5/MEF to register modules and configure them via app.config file. But a module cannot be found whenever I am using a command line parameter to start the application, eg:

I am in "C:\TEMP" and have 'Readme.txt' there and execute something like this:
"C:\Program Files\Edi\Edi.exe" Readme.txt

In this case (and only in this case) I am receiving the exception below - everything works fine though if I start the application first and use File>Open to view the contents of a file. So loading and discovering of modules seems to be dependent of my currently active directory(?).

The complete project is here:
https://edi.codeplex.com/SourceControl/latest

The module that is causing the problem is configured in
https://edi.codeplex.com/SourceControl/latest#Edi/app.config

with the line:
```
<module assemblyFile="Plugins/Log4NetTools.dll" moduleType="Log4NetTools.Module" moduleName="MEFLoadLog4NetTools" startupLoaded="true" />
```

What am I doing wrong?
Is there a way to tell PRISM to search app.config entries in the directory of the executing assembly?

Exception:
```
Microsoft.Practices.Prism.Modularity.ModuleTypeLoadingException: Failed to load type for module MEFLoadLog4NetTools.
Error was: Could not load file or assembly 'Log4NetTools.dll' or one of its dependencies. Das System kann den angegebenen Pfad nicht finden.. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Log4NetTools.dll' or one of its dependencies. Das System kann den angegebenen Pfad nicht finden. ---> System.IO.DirectoryNotFoundException: Das System kann den angegebenen Pfad nicht finden. (Exception from HRESULT: 0x80070003)
--- End of inner exception stack trace ---
at System.Reflection.AssemblyName.nGetFileInformation(String s)
at System.Reflection.AssemblyName.GetAssemblyName(String assemblyFile)
at System.ComponentModel.Composition.Hosting.AssemblyCatalog.LoadAssembly(String codeBase)
at System.ComponentModel.Composition.Hosting.AssemblyCatalog..ctor(String codeBase)
at Microsoft.Practices.Prism.MefExtensions.Modularity.MefFileModuleTypeLoader.LoadModuleType(ModuleInfo moduleInfo)
--- End of inner exception stack trace ---
at Microsoft.Practices.Prism.Modularity.ModuleManager.HandleModuleTypeLoadingError(ModuleInfo moduleInfo, Exception exception)
at Microsoft.Practices.Prism.MefExtensions.Modularity.MefFileModuleTypeLoader.LoadModuleType(ModuleInfo moduleInfo)
at Microsoft.Practices.Prism.Modularity.ModuleManager.LoadModuleTypes(IEnumerable`1 moduleInfos)
at Microsoft.Practices.Prism.MefExtensions.MefBootstrapper.Run(Boolean runWithDefaultConfiguration)
at Edi.Bootstapper.Run(Boolean runWithDefaultConfiguration)
at Edi.App.Application_Startup(Object sender, StartupEventArgs e)```


Viewing all articles
Browse latest Browse all 1878

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>