It looks like you are using in-process model which only supports .NET 6.0 (LTS). If you are looking to use .NET 7.0
or .NET 8.0
, I suggest you use isolated model as described in https://learn.microsoft.com/en-us/azure/azure-functions/functions-dotnet-class-library?tabs=v4%2Ccmd#supported-versions.
To answer the question on the exception, the dependencies are restricted to 6.0.0 as discussed in this thread and you might face similar errors with unsupported version like .NET 7.0 (similar discussions: https://github.com/Azure/azure-functions-host/issues/9685#issuecomment-1812042873, https://github.com/Azure/Azure-Functions/issues/2319). Hence you can either downgrade and validate with .NET 6.0 for in-process model or move to Isolated model for latest .NET versions.
I hope this helps and let me know if any questions.
If you found the answer to your question helpful, please take a moment to mark it as Yes
for others to benefit from your experience. Or simply add a comment tagging me and would be happy to answer your questions.