1
votes

I get the following runtime erorr while spawning an azure worker job.

System.IO.FileLoadException: 'Could not load file or assembly 'Microsoft.ServiceBus, Version=3.0.0.0, 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)'

has anyone faced same issues?

2
this might helpSyafiqur__

2 Answers

1
votes

The error message tells us that the service bus assembly is missing when deployed your project. Please check your property of your assembly. Make sure that the value of Copy Local is true before deployment.

enter image description here

Note: The Microsoft.ServiceBus.dll needs to packaged with your project because it is not available by default in Azure.

0
votes

You are most likely getting your .dll reference from your local computer. From the GAC maybe, probably. Or hard coded to a long full-file-name-path.

You should consider using nuget to pull down your dependencies.

https://www.nuget.org/packages/Microsoft.Azure.ServiceBus/3.4.0

This will allow your references to be in a relative path, and will work on your build-machine if/when you get one.

This below article will help you bridge the gap with Visual Studio and Nuget:

https://docs.microsoft.com/en-us/nuget/quickstart/install-and-use-a-package-in-visual-studio

Quickstart: Install and use a package in Visual Studio (Windows only)

07/23/2018 3 minutes to read +1 NuGet packages contain reusable code that other developers make available to you for use in your projects. See What is NuGet? for background. Packages are installed into a Visual Studio project using the NuGet Package Manager or the Package Manager Console. This article demonstrates the process using the popular Newtonsoft.Json package and a Windows Presentation Foundation (WPF) project. The same process applies to any other .NET or .NET Core project.