reflection - Prism + Log4Net build error : "Cannot resolve dependency to assembly log4net" -
i trying add log4net support in prism application. unfortunately following error each prism modules :
error 101 unknown build error, 'cannot resolve dependency assembly 'log4net, version=1.2.10.0, culture=neutral, publickeytoken=1b44e1d426115821' because has not been preloaded. when using reflectiononly apis, dependent assemblies must pre-loaded or loaded on demand through reflectiononlyassemblyresolve event.' [prism module 1 project name]
error 101 unknown build error, 'cannot resolve dependency assembly 'log4net, version=1.2.10.0, culture=neutral, publickeytoken=1b44e1d426115821' because has not been preloaded. when using reflectiononly apis, dependent assemblies must pre-loaded or loaded on demand through reflectiononlyassemblyresolve event.' [prism module 2 project name]
ect ...
i set logger follow :
- i added log4net assembly reference both main app, , bootstrapper.
- i added log4net configuration app.config file.
- i added [assembly: log4net.config.xmlconfigurator(watch = true)] app.xaml.cs file.
- i created logger implemeting iloggerfacade , overwrote createlogger() in bootstrapper make return custom logger.
that's it. if try build, fails error mentioned above each prism module project. work around found manually add log4net references each prism modules projects which, think, kind of defeats abstraction between iloggerfacade , dependencies of actual implementation.
the error suggest use reflectiononlyassemblyresolve event, don't see how here build error, not runtime.
any suggestion ? :-)
ok found problem, each modules referencing bootstrapper wrong, removed dependency , voila, fixed !
Comments
Post a Comment