kubernetes-client / csharp

Officially supported dotnet Kubernetes Client library
Apache License 2.0
1.09k stars 294 forks source link

A question about using this library with a `netcoreapp2.2` Web Api Project #501

Closed sadedil closed 3 years ago

sadedil commented 3 years ago

I have a dependecy conflict question.

When I try to add I have a KubernetesClient 2.0.33 into a netcoreapp2.2 Web Api Project as a nuget reference, I'm getting this error.

Install failed
Version conflict detected for Microsoft.AspNetCore.JsonPatch.

Install/reference Microsoft.AspNetCore.JsonPatch 3.0.0 directly to project My.WebiProject.Api to resolve this issue. 
  My.WebiProject.Api -> KubernetesClient 2.0.33 -> Microsoft.AspNetCore.JsonPatch (>= 3.0.0) 
  My.WebiProject.Api -> Microsoft.AspNetCore.App 2.2.0 -> Microsoft.AspNetCore.JsonPatch (>= 2.2.0 && < 2.3.0).

I've checked the KubernetesClient.csproj file, it seems to be supporting this frameworks <TargetFrameworks>netstandard2.0;net452;netcoreapp2.1</TargetFrameworks>

I'm a little bit confused. Shouldn't it be a supported version of Microsoft.AspNetCore.JsonPatch (like <2.3.0) when you target netcoreapp2.1 or netstandard2.0?

By the way, thanks for the project. It's very useful to me.

tg123 commented 3 years ago

can you install Microsoft.AspNetCore.JsonPatch 3.0 to your proj to force the version to 3.0?

sadedil commented 3 years ago

Hi @tg123,

Of course I can add this and solve this problem just with one additional warning. But I will never be sure, what is the side effects to our existing app.

For now, I've choose to use old version (same as the WebApi uses) of Microsoft.AspNetCore.JsonPatch. If any problem occurs, at least I hope only k8s-client will not work and main WebApi continue to work as usual.

To do this, I've added this to WebApi.csproj <PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="2.2.0" NoWarn="NU1605"/>

Thanks

tg123 commented 3 years ago

Microsoft.AspNetCore.JsonPatch was no longer a dependency and you can use any version in client side