Cannot add Application Insights - Failed to install package 'Microsoft.Web.Infrastructure'

Altoyyr picture Altoyyr · Jun 16, 2016 · Viewed 8.9k times · Source

I try to monitor the memory usage of my CloudService and stumbled upon Application Insights.

When I try to add it I get following error message:

Errormessage

  1. right click on WebProject -> Add Application Insights Telemetrik
  2. Insert Subscription-Data -> click Add-Button
  3. Now the error occurs when VS tries to install 'Microsoft.ApplicationInsights.Web.2.0.0'

We are using VS2015 and Windows 10

Edit:
The fun thing is I can install Microsoft.ApplicationInsights.Webversion 2.0.0 via the nuget-console. But when I afterwards try to add the ApplicationInsights again it throws the same error and the package-manager-console displays:

The package at \Path\To\Project\packages\Microsoft.Bcl.1.0.14 failed to uninstall. Restart Visual Studio to finish the process.

Answer

John Gardner picture John Gardner · Jun 27, 2016

Things you can try:

  1. close VS, and start it once as admin. You may have old auto-updated extensions, etc that haven't been cleaned up until you run as admin. then close that admin VS and go back to your normal non-admin VS.

  2. clear out your nuget packages in your solution, and then doing a full re-build to ensure that all of the current packages in your project are correctly and fully installed. when we try to install the AI nuget packages programmatically, Nuget tries to validate all of the existing packages and sometimes something goes wrong there validating things that already installed

  3. then try re-adding AI through the tool.

if you still get the error, look in the directory shown in the error message, and comment and let me know if (a) that folder exists at all and (b) if it does exist, what's in it?

If things are still failing, you should be able to add the Microsoft.ApplicationInsights.Web nuget package manually from nuget package manager, and after that is done, right click the "ApplicationInsights.config" file that was added by the nuget package install, and you should see a "configure application insights" option that will let you pick your account, subscription, and AI resource, and that will get updated in the config file for you. If none of that works, you can send me a mail to jgardner @ microsoft and i can try to track down more details for you.

Edit to add: If you get this error about Microsoft.Bcl, then your project is probably targeting .NET 4.0 and this is probably an issue we just found today. hypothetically, if you manually install microsoft.bcl into the project first, then that specific error for that specific package should go away? (we're working on verifying this specific dependency and fixing this asap).