Deepak
Deepak

Reputation: 2742

Could not load file or assembly 'Microsoft.Azure.Management.ServiceBus.Fluent'

I am working on Azure service bus from my console application. I have a separate project and I have installed the nuGet package "Microsoft.Azure.Management.ServiceBus.Fluent" package to get connection string using namespace. After installing the package and running the application, I get this exception:

System.IO.FileNotFoundException: 'Could not load file or assembly 'Microsoft.Azure.Management.ServiceBus.Fluent, Version=1.0.0.66, Culture=neutral or one of its dependencies. The system cannot find the file specified.'

How do I resolve it? Please leave it in the comments if I can add any other details.

Upvotes: 0

Views: 973

Answers (2)

Mr Qian
Mr Qian

Reputation: 23715

First of all, I assume you have installed Microsoft.Azure.Management.ServiceBus.Fluent version 1.36.0.

If your project is net framework with packages.config nuget package format, you could try these:

To correct the path, you should clean nuget caches first(delete all files under C:\Users\xxx\.nuget\packages) and packages folder under the solution folder

then run the below command to correct the path:

update-package -reinstall

under Tools-->Nuget Package Manager-->Package Manager Console.

Also, you could just modify the csproj file and change the hintpath of the nuget package reference to the right nuget dll path.

<Reference Include="Microsoft.Azure.Management.ServiceBus.Fluent, Version=1.0.0.66, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
      <HintPath>..\packages\Microsoft.Azure.Management.ServiceBus.Fluent.1.36.0\lib\net452\Microsoft.Azure.Management.ServiceBus.Fluent.dll</HintPath>
</Reference>

Besides, add bindingRedirect might be a safe choice.

Add this under app.config file

 <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Azure.Management.ServiceBus.Fluent" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.0.0.66" newVersion="1.0.0.66" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

=========================================================

If your project is net core project with PackageRefence nuget management format,

you should also clean nuget caches first and then delete bin and obj folder.

Upvotes: 1

Harshita Singh
Harshita Singh

Reputation: 4870

I suspect that you have installed latest version of Microsoft.Azure.Management.ServiceBus.Fluent: 1.36.1. Further, one of your nuget package has a dependency on it's version 1.0.0.66.

To resolve this, you might have to downgrade your package to 1.0.0 version or equivalent.

Upvotes: 0

Related Questions