我尝试使用Visual Studio向导将Application Insights添加到我的应用程序中 . 当我在我的办公室电脑上做它时它工作得很好 . 但是,当我尝试在家中执行此操作时,它失败并显示以下错误消息:
---------------------------
Microsoft Visual Studio
---------------------------
Could not add Application Insights to project.
Failed to install package:
Microsoft.ApplicationInsights.Web
with error:
Unable to resolve dependencies. 'Microsoft.ApplicationInsights 2.5.0' is not compatible with
'Microsoft.ApplicationInsights.DependencyCollector 2.4.1 constraint: Microsoft.ApplicationInsights (= 2.4.0)',
'Microsoft.ApplicationInsights.PerfCounterCollector 2.4.1 constraint: Microsoft.ApplicationInsights (= 2.4.0)',
'Microsoft.ApplicationInsights.Web 2.4.1 constraint: Microsoft.ApplicationInsights (= 2.4.0)',
'Microsoft.ApplicationInsights.WindowsServer 2.4.1 constraint: Microsoft.ApplicationInsights (= 2.4.0)',
'Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel 2.4.0 constraint: Microsoft.ApplicationInsights (= 2.4.0)'.
似乎我在某些部件中安装了2.5.0,在其他部件中安装了2.4 . 但是我不知道会导致什么......我只是跑了向导 . 除了Visual Studio之外,我没有安装任何东西(与App Insights相关) .
我之后尝试安装Application Insights Status Monitor,但它不会影响错误 .
如何处理这个错误的任何想法将不胜感激...
细节:
-
我正在运行一个Web API项目
-
我在完整的.net框架上运行(版本4.5.2)
2 回答
根据How NuGet resolves package dependencies .
所以,我认为这是因为包的依赖性问题 .
根据nuget.org,Microsoft.ApplicationInsights.DependencyCollector 2.4.1,Microsoft.ApplicationInsights.PerfCounterCollector 2.4.1,Microsoft.ApplicationInsights.Web 2.4.1,Microsoft.ApplicationInsights.WindowsServer 2.4.1和Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel 2.4.0完全要求ie = => Microsoft.ApplicationInsights 2.4.0但你有Microsoft.ApplicationInsights 2.5.0
所以你需要将Microsoft.ApplicationInsights 2.5.0降级为Microsoft.ApplicationInsights 2.4.0 .
要降级Microsoft.ApplicationInsights 2.5.0,您可以卸载软件包并安装所需的软件包版本 . 您可以按照以下命令操作 .
请注意 - Force 参数 . 强制卸载程序包,即使其他程序包依赖它也是如此 .
或者您可以尝试重新安装
Microsoft.ApplicationInsights
包或者你可以升级
Microsoft.ApplicationInsights
的所有依赖项你可以尝试的事情:
确保启用了工具栏:查看 - >工具栏 - >应用程序洞察 .
关闭VS,并以管理员身份启动一次 . 在以管理员身份运行之前,您可能有旧的自动更新的扩展等未经清理的扩展 . 然后关闭该管理员VS并返回正常的非管理员VS.
卸载并重新安装Microsoft.ApplicationInsights.Web包;然后,右键单击Web项目并“配置应用程序洞察” .