本文介绍了Application Insights向导失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用Visual Studio向导将Application Insights添加到我的应用程序中.当我在办公室计算机上执行此操作时,它工作正常.但是当我尝试在家中执行此操作时,它失败并显示以下错误消息:

I tried to use the Visual Studio Wizard to add Application Insights to my application. When I did it on my office computer it worked fine. But when I tried to do it at home, it failed with the following error message:


---------------------------
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相关),我没有安装任何东西.

It would seem that I have 2.5.0 installed in some parts, and 2.4 installed in other parts. But I don't know what would cause this... I just ran the wizard. I had not installed anything but Visual Studio (in relation to App Insights).

我确实尝试在以后安装Application Insights状态监视器,但是它没有影响该错误.

I did try installing the Application Insights Status Monitor afterward, but it did not affect the error.

任何有关如何处理此错误的想法将不胜感激...

Any idea on how to deal with this error would be appreciated...

详细信息:

  • 我正在运行一个Web API项目
  • 我正在完整的.net框架(版本4.5.2)上运行

推荐答案

根据 NuGet如何解决程序包依赖性.

这些直接依赖项可能随后也依赖于 自己,可以持续到任意深度.这产生 所谓的依赖关系图,描述关系 在各个级别的软件包之间.

Those immediate dependencies might then also have dependencies on their own, which can continue to an arbitrary depth. This produces what's called a dependency graph that describes the relationships between packages at all levels.


当您的计算机中引用的一个或多个软件包时,会发生此错误 项目不表示他们支持项目的目标 框架;也就是说,该程序包中不包含合适的DLL. 与项目兼容的目标框架的lib文件夹.

This error occurs when one or more of the packages referenced in your project do not indicate that they support the project's target framework; that is, the package does not contain a suitable DLL in its lib folder for a target framework that is compatible with the project.

所以,我认为这是由于软件包的依赖性问题造成的.

So, I think this is because of dependency issues of packages.

根据 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 要求完全等于=不> = Microsoft.ApplicationInsights 2.4.0 ,但是您有 Microsoft.ApplicationInsights 2.5.0

According to 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 and Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel 2.4.0 require exactly i.e. = not >= Microsoft.ApplicationInsights 2.4.0 but you have Microsoft.ApplicationInsights 2.5.0

因此,您需要将 Microsoft.ApplicationInsights 2.5.0 降级为 Microsoft.ApplicationInsights 2.4.0 .

So you need to downgrade the Microsoft.ApplicationInsights 2.5.0 to Microsoft.ApplicationInsights 2.4.0.

要降级 Microsoft.ApplicationInsights 2.5.0 ,您可以卸载该软件包并安装所需版本的软件包.您可以按照以下命令进行操作.

To downgrade the Microsoft.ApplicationInsights 2.5.0 you can uninstall the package and install the required version of the package. You can follow the following command.

Uninstall-Package Microsoft.ApplicationInsights -Force
Install-Package Microsoft.ApplicationInsights -Version 2.4.0    

请注意- Force 参数.强制卸载软件包,即使其他软件包依赖于此软件包.

Note the -Force parameter. Forces a package to be uninstalled, even if other packages depend on it.

或者您可以尝试重新安装Microsoft.ApplicationInsights软件包

Or you can try to reinstall Microsoft.ApplicationInsights package

Update-Package -Reinstall Microsoft.ApplicationInsights

或者您可以升级Microsoft.ApplicationInsights

Update-Package Microsoft.ApplicationInsights.DependencyCollector -Version 2.5.0
Update-Package Microsoft.ApplicationInsights.PerfCounterCollector -Version 2.5.0
Update-Package Microsoft.ApplicationInsights.Web -Version 2.5.0
Update-Package Microsoft.ApplicationInsights.WindowsServer -Version 2.5.0
Update-Package Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel -Version 2.5.0

这篇关于Application Insights向导失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 19:26