Using Azure Functions, Cosmos db and Entity Framework together

Mark Theobald 5 Reputation points
2023-02-14T16:16:33.82+00:00

Is it possible to create a functions app that uses cosmos db and entity framework? Every time I try create an Azure Function app targeting .Net 6 LTS and add the nu-get package Microsoft.EntityFrameworkCore.Cosmos, and try to run the app I get the following error: " Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified." even though that file is listed as an "Installed" nu-get package.

Is this a bug or am I doing something wrong...

TIA,

Mark

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,589 questions
{count} vote

1 answer

Sort by: Most helpful
  1. MuthuKumaranMurugaachari-MSFT 22,416 Reputation points
    2023-02-21T15:37:02.65+00:00

    Mark Theobald Thank you for posting your question in Microsoft Q&A. Based on my understanding, you are trying to use Microsoft.EntityFrameworkCore 7.0.0 in .NET 6.0 and faced the above-mentioned error.

    As described in https://github.com/Azure/Azure-Functions/issues/2319, we have a limitation of in-proc model in V4 running on .NET 6 which supports the dependencies to 6.0.0 (not 7.0.0). Hence you can either move to Isolated model (https://techcommunity.microsoft.com/t5/apps-on-azure-blog/announcing-the-net-7-for-azure-functions-isolated-worker-process/ba-p/3671398) or change your dependencies to 6.0.0. If you have any concerns or feedback on this limitation, feel free to share it on the same GitHub thread or open new issue for Cosmos (but underlying limitation are the same).

    I hope this helps with your question but feel free to let me know for any other questions or face issues with Isolated model.


    Please accept as "Yes" if the answer is helpful, so that it can help others in the community.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.