Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot resolve symbol 'EnterpriseLibraryContainer'

I just started to try out the new MS Enterprise Library 6.0 Logger block. When I try to create a LogWriter, I get the error:

Cannot resolve symbol 'EnterpriseLibraryContainer'

I have all the references and usings in place, but can't get past this error.

Is there a solution to this issue?

like image 458
Doug J. Huras Avatar asked May 01 '13 17:05

Doug J. Huras


1 Answers

Halleluiah! I just found a post (on a link that has since disappeared). Here's the story:

The bootstrapping code for all of the blocks has changed in version 6 of Enterprise Library. The blocks no longer use Unity to manage the initialization and configuration, and each block now includes its own bootstrapping code. Any calls to the EnterpriseLibraryContainer.Current.GetInstance method to resolve a type from one of the Enterprise Library blocks should be replaced with the block specific bootstrap code. For example, to create a LogWriter instance based on configuration in the app.config file, you can now use the following code:

LogWriterFactory logWriterFactory = new LogWriterFactory();
var logWriter = logWriterFactory.Create();

I believe that this blurb is from the "Microsoft Enterprise Library 6 and Unity 3 Migration Guide".

I've entered the code as shown and don't have the compiler complaining. Now I can continue to see how the logging works.

like image 165
Doug J. Huras Avatar answered Sep 18 '22 14:09

Doug J. Huras