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://learn.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?
In the documentation, there is a explicit note that says:
That means, they know about this problem, but will let to you discover it. :)
Microsoft.ServiceFabric.Diagnistics.Internal
is an implicity dependency onMicrosoft.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 packageMicrosoft.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.