Publish in Azure: Mismatch dependency error. What is causing it and how to fix it when using publishing via a pipeline?


When I run for the first time or publish my project to a web-server via Visual Studio I get sometimes this type of error.

Could not load file or assembly 'Microsoft.Owin, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I can fix it by running the following command in the console and running or publishing again

Update-Package –reinstall Package.Name

I wonder what is the reason for this error and how could I fix it if I am publishing through a pipeline and therefore I cannot run the command in the console when it fails.

asked on Stack Overflow Jan 14, 2021 by Odd Kviteberg

1 Answer


Try using the assembly Binding Log Viewer. It should give you more details about the problem.

We could also find the referenced assembly in Solution Explorer and in the Properties window, set the field Copy Local to True. It should also fix this issue.

In the Azure DevOps, since you have fix this issue via the cmd Update-Package –reinstall Package.Name, we could also add the task Command as the first task and enter the cmd Update-Package –reinstall Package.Name to reinstall the package.

Please also check this ticket.

answered on Stack Overflow Jan 15, 2021 by Vito Liu-MSFT

User contributions licensed under CC BY-SA 3.0