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

自闭症网瘾萝莉.ら 提交于 2020-01-03 08:08:45

问题


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:

  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.


回答1:


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).



来源:https://stackoverflow.com/questions/37852878/cannot-add-application-insights-failed-to-install-package-microsoft-web-infra

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!