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:
Open the Application Insights Search telemetry window in Visual Studio. While debugging, select the Application Insights dropdown box. Select an exception report to show its stack trace. To open the relevant code file, select a line reference in the stack trace.
Because the workspace-based Application Insights enhances your monitoring experience, we retire the classic Application Insights on 29 February 2024.
How long is the data kept? Raw data points (that is, items that you can query in Analytics and inspect in Search) are kept for up to 730 days. You can select a retention duration of 30, 60, 90, 120, 180, 270, 365, 550, or 730 days.
View logs in Application InsightsGo to Application Insights resource in your resource group. Go to Logs under Monitoring section. Click on traces eye button to get log traces. Select Time Range and click Run.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With