Search code examples
c#azureasp.net-coreasp.net-core-3.0azure-app-service-envrmnt

Azure App Service throwing Runtime Error: Assembly not Found


I am trying to deploy an ASP.NET Core web application to Azure App Service.

I built the App Service to use the .NET Core 3.0 runtime, and it runs well on that version of the framework locally. However, when I attempt to run the application in the App Service, it hits the following error:

Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.Razor.Runtime, Version=3.0.3.0, Culture=neutral, PublicKeyToken=[]'. The system cannot find the file specified.

I am not directly calling that Razor runtime, so basically, I need to figure out which other library is actually asking for that assembly, or alternatively, why the application would run on my local machine, but not on the App Service. Supposedly both environments have .NET Core 3.0 installed.

The biggest confusion for me is that NuGet does not show any version of that library past 2.2. Otherwise I would just explicitly include that package from NuGet.

How can I figure out which other assembly is requesting the Razor runtime, or at least resolve that request to a valid assembly?


Solution

  • The library Microsoft.VisualStudio.Web.CodeGeneration.Design was the source of this issue. It was calling for Microsoft.AspNetCore.Razor.Runtime, though it was not directly requesting 3.0.3.0, as far as I can tell.