title: Could not load file or assembly Microsoft.Data.OData Version=5.2.0.0 error in Azure Cloud Worker Role using Table Storage
body: <p>I have a very peculiar issue using Azure Table Storage. I have a .NET 4.5 project in Visual Studio 2012 where I deal with all my Azure Table Storage functions. This project/dll is referenced by two other projects, my MVC website, and my Azure Worker Role. (I am running under the Azure Emulators on my machine, but it also happens when I deploy it to the cloud)</p>
  
  <p>I have the following function that is called when I save or retrieve a record:</p>
  
  <pre><code>internal static CloudTable GetTable(CloudStorageAccount storageAccount, string tableReference)
  {
      CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
  
      CloudTable table = tableClient.GetTableReference(tableReference);
      table.CreateIfNotExists();
  
      return tableClient.GetTableReference(table.Name);
  }
  </code></pre>
  
  <p>In my MVC website I have a function that will save a record to a Azure Storage table, and then in my Azure Worker Role there is a service that will read the record. </p>
  
  <p>So both uses the same dll for storage and retrieval, however my MVC project has no issues saving the record, but in my Azure Worker role service when it tries to retrieve the record throws the exception when it attempts to execute "table.CreateIfNotExists();".</p>
  
  <blockquote>
    <p>Could not load file or assembly 'Microsoft.Data.OData,
    Version=5.2.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)</p>
  </blockquote>
  
  <p>I have done the following already:</p>
  
  <ol>
  <li>Updated all the NuGet packages from the solution level to the latest versions</li>
  <li>I went through every project reference to make sure that there are no old dll's or previous versions hanging around, in particular the System.Spatial, Microsoft.WindowsAzure.Configuration, Microsoft.WindowsAzure.ServiceRuntime and Microsoft.ServiceBus, Microsoft.WindowsAzure.Storage, Microsoft.Data.Edm &amp; Microsoft.Data.OData</li>
  <li>I have even created a new Cloud Service and WorkerRole project from scratch to make sure it is not something in the current WorkerRole project that is broken.</li>
  </ol>
  
  <p>I have not rolled the dll's back to 5.2 as I had too many issues in other projects where I use features that are specific from 5.3 onwards.</p>
  
  <p>I am currently running all the dll's on 5.5.</p>
  
  <p>When I run the AsmSpy.exe utility found <a href="https://github.com/mikehadlow/AsmSpy" rel="noreferrer">here</a>, I get the following output that I am not 100% sure how to interpret.</p>
  
  <pre><code>&gt; Reference: Microsoft.Data.Edm
  &gt;         5.5.0.0 by Microsoft.Data.OData
  &gt;         5.5.0.0 by Microsoft.Data.Services.Client
  &gt;         5.5.0.0 by Microsoft.WindowsAzure.ActiveDirectory.GraphHelper.2013_04_05
  &gt; Reference: System.Spatial
  &gt;         5.5.0.0 by Microsoft.Data.OData
  &gt;         5.5.0.0 by Microsoft.Data.Services.Client Reference: Microsoft.Data.OData
  &gt;         5.5.0.0 by Microsoft.Data.Services.Client
  &gt;         5.2.0.0 by Microsoft.WindowsAzure.Storage   &lt;-- THIS SEEMS TO BE THE ONE THAT IS CAUSING ISSUES
  </code></pre>
  
  <p>How I interpret it, is that the Microsoft.WindowsAzure.Storage dll is referencing V 5.2.0.0 of the Microsoft.Data.OData dll, but how do I fix this, if this is the issue? According to the documentation I have seen on the Storage dll is that it is supposed to reference 5.4 and up, not 5.2...?</p>