I am receiving the following error after publishing to Azure App Service.
Could not load file or assembly 'Microsoft.ApplicationInsights, Version=1.2.0.5639, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
In the WebAPI project I clearly see the Microsoft.ApplicationInsights reference and the version number is "1.2.0.5639".
I am using VSO as my build server (vNext not XAML-based). I noticed in the VSO build logs that I was receiving a warning that the DLL was missing as well.
C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1819,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.ApplicationInsights, Version=1.2.0.5639, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
The build server also clearly shows this:
Primary reference "Microsoft.ApplicationInsights, Version=1.2.0.5639, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL".
With the following warning:
[warning]C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1819,5):
Warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.ApplicationInsights, Version=1.2.0.5639, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
The only thing I can think of right now is maybe the processor architecture being MSIL is the problem?
UPDATE: I am also publishing 3 web jobs (each that user Application Insights in their own right). Currently I am including the webjobs in the 'webjobs-list.json' file but I'm removing it to hopefully isolate the issue. It appears that 2 / 3 webjobs are able to find the DLL and are copying it to their
UPDATE 2: Removing the WebJobs from the JSON file didn't help.
UPDATE 3: OK, so I managed to get it working. BUT, only when I deploy from Visual Studio IDE, not through my automated build on VSO. :*( I used the Visual Studio context menu by right clicking on the WebAPI project then finding Application Insights menu item and using the 'add application insights wizard'. This is strange because App Insights has been working for quite some time in this project. But after I linked it to my existing app insights instance it added a few entries into web.config. Build / deploy got the WebAPI to start working again. I even added back in the WebJobs to the JSON file.