September 08, 2010

Could not load file or assembly 'NLog'


Last week we had a problem when trying to test a dll which has used nlog.

When you use nlog, we normally code it as below,


This gave "Could not load file or assembly 'NLog'" exception.

We tried out many things, but still this was a real headache for us. But finally, we were able to solve it.

After doing many researches, we found out that since we are not using a strong name for the nlog assembly it is impossible to do GAC lookup. Therefore system cannot find the actual nlog path from GAC. So it throws an exception.

We were able to solve this problem by including the below section in the config file.



No comments:

Post a Comment