Application Insights 向导失败 [英] Application Insights Wizard Failure

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

问题描述

我尝试使用 Visual Studio 向导将 Application Insights 添加到我的应用程序中.当我在我的办公室电脑上做这件事时,它工作得很好.但是当我尝试在家里做时,它失败并显示以下错误消息:

<上一页>--------------------------微软视觉工作室--------------------------无法将 Application Insights 添加到项目.安装包失败:Microsoft.ApplicationInsights.Web有错误:无法解决依赖关系.Microsoft.ApplicationInsights 2.5.0"不兼容'Microsoft.ApplicationInsights.DependencyCollector 2.4.1 约束:Microsoft.ApplicationInsights (= 2.4.0)','Microsoft.ApplicationInsights.PerfCounterCollector 2.4.1 约束:Microsoft.ApplicationInsights (= 2.4.0)','Microsoft.ApplicationInsights.Web 2.4.1 约束:Microsoft.ApplicationInsights (= 2.4.0)','Microsoft.ApplicationInsights.WindowsServer 2.4.1 约束:Microsoft.ApplicationInsights (= 2.4.0)','Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel 2.4.0 约束:Microsoft.ApplicationInsights (= 2.4.0)'.

似乎我在某些部分安装了 2.5.0,而在其他部分安装了 2.4.但我不知道是什么原因造成的……我只是运行了向导.除了 Visual Studio(与 App Insights 相关),我没有安装任何东西.

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

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

详情:

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

解决方案

根据NuGet 如何解决包依赖关系.

<块引用>

任何时候安装或重新安装软件包,包括作为还原过程的一部分安装,NuGet 还安装任何第一个包所依赖的其他包.

那些直接依赖可能也依赖于他们自己的,可以继续到任意深度.这产生所谓的描述关系的依赖图各级包之间.

<小时><块引用>

在包还原操作期间,您可能会看到错误一个或多个包不兼容..."或包不兼容"与项目的目标框架.

当您在项目不表明他们支持项目的目标框架;也就是说,包中不包含合适的 DLLlib 文件夹,用于与项目兼容的目标框架.

所以,我认为这是因为包的依赖问题.

根据 nuget.orgMicrosoft.ApplicationInsights.DependencyCollector 2.4.1, Microsoft.ApplicationInsights.PerfCounterCollector 2.4.1, Microsoft.ApplicationInsights.Web 2.4.1, Microsoft.ApplicationInsights.WindowsServer 2.4.1Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel 2.4.0 完全需要 ie = not >= Microsoft.ApplicationInsights 2.4.0 但你有 Microsoft.ApplicationInsights 2.5.0

所以你需要降级 Microsoft.ApplicationInsights 2.5.0Microsoft.ApplicationInsights 2.4.0.

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

卸载-Package Microsoft.ApplicationInsights -Force安装包 Microsoft.ApplicationInsights -版本 2.4.0

注意 -Force 参数.强制卸载一个包,即使其他包依赖于它.

或者你可以尝试重新安装Microsoft.ApplicationInsights

Update-Package -Reinstall Microsoft.ApplicationInsights

或者你可以升级Microsoft.ApplicationInsights

的所有依赖

更新包 Microsoft.ApplicationInsights.DependencyCollector -Version 2.5.0更新包 Microsoft.ApplicationInsights.PerfCounterCollector -版本 2.5.0更新包 Microsoft.ApplicationInsights.Web -版本 2.5.0更新包 Microsoft.ApplicationInsights.WindowsServer -Version 2.5.0更新包 Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel -版本 2.5.0

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

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

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

Details:

  • I am running a Web API project
  • I am running on the full .net framework (version 4.5.2)

解决方案

According to How NuGet resolves package dependencies.

Any time a package is installed or reinstalled, which includes being installed as part of a restore process, NuGet also installs any additional packages on which that first package depends.

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.


During a package restore operation, you may see the error "One or more packages are not compatible..." or that a package "is not compatible" with the project's target framework.

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.

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

So you need to downgrade the Microsoft.ApplicationInsights 2.5.0 to Microsoft.ApplicationInsights 2.4.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    

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

Or you can try to reinstall Microsoft.ApplicationInsights package

Update-Package -Reinstall Microsoft.ApplicationInsights

Or you can upgrade all the dependencies of 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 向导失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆