Problem when i try to publish my ASP.NET CORE web app in azure - Could not load file or assembly 'Microsoft.Extensions.Identity.Core

1

I am new in asp.net core and azure. I have small web app on asp.net core mvc, and I want to publish this project to azure. Locally the project work fine, but when I try to build the project through the console on azure, this error appears -

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Extensions.Identity.Core, Version=2.1.6.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) at program.Startup.ConfigureServices(IServiceCollection services)

When i try to open across his link I see this: An error occurred while starting the application. .NET Core 4.6.27129.04 X86 v4.0.0.0 | Microsoft.AspNetCore.Hosting version 2.1.1-rtm-30846 | Microsoft Windows 10.0.14393 | Need help?

And my question is: What I need to do, to fix this error ?

c#
asp.net-mvc
azure
identity
asked on Stack Overflow Jan 18, 2019 by gru • edited Jan 29, 2019 by gru

1 Answer

0

I'm getting a very similar error on my core 2.1 site published as an Azure App Service:

System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Could not load file or assembly 'Microsoft.Extensions.Identity.Core, Version=2.1.6.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

It was running perfectly until it suddenly stopped working. I honestly don't know why the issue started but in the mean time I solved it by changing the "Deployment Mode" to "Self-Contained" on the publish profile settings.

To get there just right click your website, click on publish, select your profile and click on Configure. Then click on Settings and change the "Deployment Mode". That will add all the ddl's locally and get your site working again.

Visual Studio publish profile

answered on Stack Overflow Jan 20, 2019 by ismaelf

User contributions licensed under CC BY-SA 3.0