microsoft / ApplicationInsights-ServiceFabric

ApplicationInsights SDK for ServiceFabric projects
MIT License
63 stars 26 forks source link

library causes version conflict when using Microsoft.Services.ServiceFabric >= 3.3.664 #108

Closed DOliana closed 4 years ago

DOliana commented 4 years ago

When referencing a version of Microsoft.Services.ServiceFabric >= 3.3.664 in the SF-Service project, trying to add a reference to Microsoft.ApplicationInsights.ServiceFabric.Native causes a version conflict.

Sample error:

Fehler  NU1107  Versionskonflikt entdeckt für "Microsoft.ServiceFabric.Diagnostics.Internal". Installieren bzw. referenzieren Sie "Microsoft.ServiceFabric.Diagnostics.Internal 4.0.457" direkt in Projekt "SF-Service", um dieses Problem zu beheben. 
 SF-Service-> Microsoft.ServiceFabric.Services 4.0.457 -> Microsoft.ServiceFabric.Diagnostics.Internal (= 4.0.457) 
 SF-Service-> Common.ServiceFabricCommons -> Microsoft.ApplicationInsights.ServiceFabric.Native 2.3.1 -> Microsoft.ServiceFabric.Services.Remoting 3.3.664 -> Microsoft.ServiceFabric.Diagnostics.Internal (= 3.3.664).     
brahmnes commented 4 years ago

Hi @DOliana,

Microsoft.ApplicationInsights.ServiceFabric.Native is pretty easy going with reference versions. If you look at the nuget page, all service fabric version dependencies are declared with a >= constraint. https://www.nuget.org/packages/Microsoft.ApplicationInsights.ServiceFabric.Native/

It looks like you can resolve it by installing explicitly a version of Microsoft.ServiceFabric.Services.Remoting 4.0.457 first, which should be compatible with Microsoft.ServiceFabric.Services 4.0.457. Then installing Microsoft.ApplicationInsights.ServiceFabric.Native should work.

DOliana commented 4 years ago

I know (or at least am pretty sure) I can solve it by referencing versions directly. The thing is, that then I will have to monitor that dependency on every future update.

It probably isn't even the fault of the app insights-library but more of the remoting-library for having a hard dependency.

My question is, whether there is an alternative way of doing this.

brahmnes commented 4 years ago

I don't know of a better way. I think this is a general nuget problem. As a general practice, it may be better to ensure all Microsoft.ServiceFabric.* nugets to stay in sync for version numbers, but I assume in your case, it's the application insights library that's bringing in the remoting dependency.

yantang-msft commented 4 years ago

Closing this issue as it has been reported couple times https://github.com/microsoft/ApplicationInsights-ServiceFabric/issues/79, https://github.com/microsoft/ApplicationInsights-ServiceFabric/issues/82, and we suggest specifying the version explicitly.