how to fix : Could not load file or assembly 'Azure.Core'

Peter Clift (INFOSYS LIMITED) 11 Reputation points
2022-09-01T19:06:45.273+00:00

I have a .net framework 4.2 Test Project, which calls methods in .net 4.2 a class library called Interface. Interface references another class library that holds the nuget 'azure.core'

in the test project , I tried adding a bindingRedirect to app.config , but did not fix :

      <dependentAssembly>  
        <assemblyIdentity name="Azure.Core" publicKeyToken="92742159e12e44c8" culture="neutral" />  
        <bindingRedirect oldVersion="0.0.0.0-1.25.0.0" newVersion="1.25.0.0" />  
      </dependentAssembly>  

here is the error :
Exeption message "Could not load file or assembly 'Azure.Core, Version=1.25.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"Azure.Core, Version=1.25.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8"} System.Exception {System.IO.FileLoadException}

inner exception : - InnerException {"Could not load file or assembly 'Azure.Core, Version=1.19.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"Azure.Core, Version=1.19.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8"} System.Exception {System.IO.FileLoadException}

Any tips?
Thanks,Peter

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,342 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Peter Clift (INFOSYS LIMITED) 11 Reputation points
    2022-09-14T20:06:07.287+00:00

    I answered my question. I added this to csproj of calling test project :

    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>  
    <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
    
    1 person found this answer helpful.