Share via

Cannot get past "Could not load file or assembly 'System.Linq.Expressions, Version=8.0.0.0"

Kurtis Lininger 0 Reputation points
2026-04-06T03:17:05.5233333+00:00

I followed the steps to create my-first-static-web-app. My sample azure function is in c#.

I stumbled thru many of the steps, but finally have a page with a button that tries to call an azure function. The simple page works locally, but in the cloud the log says "Could not load file or assembly 'System.Linq.Expressions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified." I've googled this for a few hours and it seems people had this problem when upgrading an app to .NET 8, but this is a fresh app. I've even added a line in my api.csproj to add Linq directly, but that doesn't affect things.

What am I missing?

Azure Static Web Apps
Azure Static Web Apps

An Azure service that provides streamlined full-stack web app development.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Shree Hima Bindu Maganti 7,190 Reputation points Microsoft External Staff Moderator
    2026-04-06T17:53:07.81+00:00

    Hi @Kurtis Lininger
    This error occurs because your Azure Function is built targeting .NET 8, but the runtime used by Azure Static Web Apps APIs is not aligned with that version, so it cannot resolve assemblies like System.Linq.Expressions (v8.0.0.0) at runtime. In Static Web Apps, the Functions backend must run on a supported runtime configuration, and .NET 8 is only supported using the isolated worker model on Azure Functions v4 if your project is using the in-process model or the deployment pipeline is not correctly configured, the platform falls back to an older runtime (such as .NET 6/7), causing this assembly load failure. To resolve this, update your function to use the .NET 8 isolated model (TargetFramework net8.0 with Microsoft.Azure.Functions.Worker), ensure your workflow is deploying the API correctly, or downgrade to .NET 6 which is fully supported by default in Static Web Apps.
    https://learn.microsoft.com/en-us/azure/azure-functions/dotnet-isolated-process-guide?tabs=ihostapplicationbuilder%2Ccode%2Cwindows
    https://learn.microsoft.com/en-us/azure/azure-functions/migrate-dotnet-to-isolated-model?tabs=net8
    Let me know if you have any further assistance needed.

    0 comments No comments

Your answer

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