2
votes

I am trying to get NLog to work with Microsoft Application Insights. I followed the instructions here:

How do I use Microsoft Application Insights with NLog (Target cannot be found: 'ApplicationInsights')

The above instructions got me through getting an ApplicationInsights target to register, however, now I am getting this error:

Could not load file or assembly 'Microsoft.ApplicationInsights, Version=0.7.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) 

Line 10:     public class HomeController : Controller
Line 11:     {
Line 12:         private static Logger logger = LogManager.GetCurrentClassLogger();
Line 13: 

I'm not too familiar with how assemblies are registered so please excuse my lack of knowledge here. I tried removing then re-adding Application Insights from my web app, as well as uninstalling and re-installing the ApplicationInsights.NLogTarget Nuget Package, but to no avail.

Any suggestions?

1
my first suggestion would be to move up to the newer, Azure Portal based version of App Insights. the 0.7.0.0 versions are pretty old (current is 0.13.x.y), so you might be running into things that have already been fixed?John Gardner

1 Answers

1
votes

Please upgrade to the latest version (currently 0.17.0) of the Microsoft.ApplicationInsights.NLogTarget NuGet package and its dependencies.