elastic / elasticsearch-net

This strongly-typed, client library enables working with Elasticsearch. It is the official client maintained and supported by Elastic.
https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/index.html
Apache License 2.0
15 stars 1.15k forks source link

Latest MINOR package version does not support .Net 6 anymore. #8179

Closed deMD closed 6 months ago

deMD commented 6 months ago

Elastic.Clients.Elasticsearch version: 8.13.11

.NET runtime version: .Net 6

Description of the problem including expected versus actual behavior: When deploying a Function App to Azure, we get an error and the app does not start.

Error configuring services in an external startup class. Elastic.Transport: Could not load file or assembly 'System.Text.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'

Steps to reproduce:

  1. Create a .Net 6 In Process Function App
  2. Reference the Elasticsearch Client
  3. Deploy on Azure

Expected behavior A reference to at least a version of Elastic.Transport that supports .Net 6 (0.4.17) when that is the Target Framework

flobernd commented 6 months ago

Hi @deMD,

this looks like something specific to the weird Azure functions runtime.

Elastic.Transport targets net6 - just like the ES client does. However, all new versions are pulling in System.Text.Json 8. This shouldn't be a problem as it is just a regular NuGet package (and as well has a dedicated net6 target).

I know from my past experience, that the Azure Functions SDK might remove packages during the pack/deployment step. There was a trick to prevent it from removing specific packages, but I sadly can't remember what was required for that. Maybe you can do some research in that direction.

Edit: Not a super good solution, but it shows that you are not the only one with that issue: https://stackoverflow.com/questions/78003857/net-8-azure-function-throws-error-when-using-system-text-json

github-actions[bot] commented 6 months ago

This issue is stale because it has been open 5 days with no activity. Remove stale label or comment or this will be closed in 2 days.

github-actions[bot] commented 6 months ago

This issue was closed because it has been stalled for 2 days with no activity.