firebase / firebase-admin-dotnet

Firebase Admin .NET SDK
https://firebase.google.com/docs/admin/setup
Apache License 2.0
366 stars 131 forks source link

conflict between FirebaseAdmin 1.17.1 and Google.Cloud.Firestore 2.2.0 #264

Closed mhDuke closed 3 years ago

mhDuke commented 3 years ago

there is a conflict arises when I include both FirebaseAdmin 1.17.1 and Google.Cloud.Firestore 2.2.0 packages.

FirebaseAdmin 1.17.1 package has a dependency on Google.Api.Gax 2.7.0. Google.Cloud.Firestore 2.2.0 package has a dependency on Google.Api.Gax 3.2.0.

When installing both packages side by side in one .Net project, the FirebaseAdmin 1.17.1 automatically grabs the higher version Google.Api.Gax 3.2.0 which causes compile errors. specifically because the use of Microsoft.Bcl.AsyncInterfaces in Google.Api.Gax 3.2.0 while using System.Interactive.Async in Google.Api.Gax 2.7.0

I guess this issue belongs here because FirebaseAdmin is not restricting Google.Api.Gax dependency to version 2.7.0

When installing FirebaseAdmin 1.17.1 solely. google api gax

When installing both packages google api gax_together

TheSpy commented 3 years ago

I think it's the same issue as https://github.com/firebase/firebase-admin-dotnet/issues/207

mhDuke commented 3 years ago

as per microsoft documentation, adding square brackets around package version number should solve the issue. for example: <PackageReference Include="Google.Api.Gax" Version="[2.7.0]" />

hiranya911 commented 3 years ago

Our Gax dependency is due for an upgrade (see #251). I think the same PR should address this issue as well.

hiranya911 commented 3 years ago

Also I wish there was a way in .NET to restrict a dependency to specific major version (like NPM does for Node.js). It seems this can be achieved by specifying versions as [2.0.0, 3.0.0) (which means any 2.x.x version but not. 3.x.x).

See https://docs.microsoft.com/en-us/nuget/concepts/package-versioning#version-ranges

mhDuke commented 3 years ago

Google.Api.Gax.Rest 3.2.0 should solve the issue. And yes, this is exactly what you might go for [2.0.0, 3.0.0). inclusive minimum, and exclusive maximum. I learnt some good stuff today. thanks.