Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microsoft.ApplicationInsights missing

Tags:

c#

.net

asp.net

I am having problem with starting ASP.NET MVC5 application. Everything was working fine until now. While starting application I am getting below error:

Could not load file or assembly 'Microsoft.ApplicationInsights, Version=1.2.3.490, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.ApplicationInsights, Version=1.2.3.490, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

I have Microsoft.ApplicationInsights 1.2.3 installed. I also tried clean, rebuild, restart computer, restart computer and leave the room etc etc.

Does someone have any idea how to solve that problem ?

like image 237
miechooy Avatar asked May 05 '16 13:05

miechooy


3 Answers

If you have a message like:

Could not load file or assembly '[Any-Package-Name], Version=[Any-Version]

This mean that you have issues with compatibility between different projects. In my case I had the nuget package Microsoft.ApplicationInsights with version 2.8.1 and one of the projects had 2.4. So I got RunTime Error, you need to have the same versions of the nuget packages that you are using in all your projects for not having this errors.

SOLUTION:

  • Right click on solution
  • Manage Nuget Packages for Solution
  • Search the package which you are having the issue
  • Click all the projects that are using the nuget package
  • Select the version for install/update in all of them
  • Click "Install"
  • Rebuild your Solution
like image 151
Dayán Ruiz Avatar answered Sep 20 '22 12:09

Dayán Ruiz


Try reinstalling the package using NuGet package manager. Install an updated version if possible.

like image 34
elfico Avatar answered Sep 22 '22 12:09

elfico


I installed the new version with Install-Package Microsoft.ApplicationInsights -Version 2.10.0 and I got the same error.
I added this line into Web.config under <runtime><assemblyBinding ...> and it seems working for me, make sure to have Microsoft.ApplicationInsights.dll file in the bin folder as well. Good luck.

<dependentAssembly>
  <assemblyIdentity name="Microsoft.ApplicationInsights" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
  <bindingRedirect oldVersion="0.0.0.0-2.10.0.0" newVersion="2.10.0.0"/>
</dependentAssembly>
like image 23
DatJunior Avatar answered Sep 18 '22 12:09

DatJunior