0
votes

I am working on a project which is using Service Fabric for microservices. I quite new to ServiceFabric and my first assignment is to use ApplicationInsight to collect telemetry data from the Service Fabric application. So I was supposed to use the Microsoft.ApplicationInsights.ServiceFabric.Native package, since it would be possible to capture SF context data with telemetry. I am also referring to https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-tutorial-monitoring-aspnet documentation.

As a initial step, I created a sample stateless SF project with a default template and configured Application Insight. Then I tried to install Microsoft.ApplicationInsights.ServiceFabric.Native package per the documentation. But I got the below error:

Install-Package : NU1107: Version conflict detected for Microsoft.ServiceFabric.Diagnostics.Internal. Reference the package directly from the project to resolve this issue. 
 BasicCalculatorService -> Microsoft.ServiceFabric.Services 3.2.162 -> Microsoft.ServiceFabric.Diagnostics.Internal (= 3.2.162) 
 BasicCalculatorService -> Microsoft.ApplicationInsights.ServiceFabric.Native 2.1.1 -> Microsoft.ServiceFabric.Services.Remoting 3.0.467 -> Microsoft.ServiceFabric.Diagnostics.Internal (= 
3.0.467).
At line:1 char:1
+ Install-Package Microsoft.ApplicationInsights.ServiceFabric.Native -V ...

It seems like Microsoft.ServiceFabric.Diagnostics.Internal is not updated on the Microsoft.ApplicationInsights.ServiceFabric.Native package to work with SF.

How can I proceed with this? Should I to download the NuGet package separately and reference the assembly manually?

1

1 Answers

1
votes

In the documentation, there is a explicit note that says:

You may need to install the Microsoft.ServiceFabric.Diagnistics.Internal package in a similar fashion if not preinstalled before installing the Application Insights package

That means, they know about this problem, but will let to you discover it. :)

Microsoft.ServiceFabric.Diagnistics.Internal is an implicity dependency on Microsoft.ServiceFabric.Services, because both are implicit and target different versions, you have to explicitly declare which one you to use for both.

In this case, you should add the package Microsoft.ServiceFabric.Diagnostics.Internal 3.2.162 before you install the package Microsoft.ApplicationInsights.ServiceFabric.Native

Just keep in mind, because they target different versions, you might face issues on runtime, the ideal would be having both on same version.