Question

DDL19 on Mon, 21 Jan 2013 23:05:34


Getting Error trying to create table in Azure Table storage. Error is

"Could not load file or assembly 'Microsoft.Data.OData, Version=5.0.2.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)

Loaded NuGet Odata. Cant find EDM and Spatial. Is this the problem?


Sponsored



Replies

Saad Nawaz on Mon, 21 Jan 2013 23:33:42


Hi,

Have you installed Microsoft.Data.OData 5.2.0.0 from NuGet package manager? If not, then please follow these steps:

1) Open your solution

2) Open NuGet Package Manager for Solution (found under Tools -> Library Package Manager -> Manage NuGet Packages for Solution ...

3) Select "Online" tab in the Manage NuGet Package window

4) Search for "Microsoft.Data.OData".

5) Install "ODataLib"

After following the above steps, you should be able to run the program without any issue.

DDL19 on Mon, 21 Jan 2013 23:39:35


OData, EDM and Spatial are all installed...

DDL19 on Mon, 21 Jan 2013 23:49:16


These are installed at the Worker role level where they are used. should this be at the higher Solution level?

DDL19 on Tue, 22 Jan 2013 00:00:35


Made sure these assemblies were available at solution level...same error being produced..Error produced

on CreateIfNotExists....

namespace WorkerRole1
{
    public class WorkerRole : RoleEntryPoint
    {
        public override void Run()
        {
            // This is a sample worker implementation. Replace with your logic.
            Trace.WriteLine("WorkerRole1 entry point called", "Information");

           CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
          CloudConfigurationManager.GetSetting("MarketviewConnectionString"));

            // Create the table client.
            CloudTableClient tableClient = storageAccount.CreateCloudTableClient();

            // Create the table if it doesn't exist.
            CloudTable table = tableClient.GetTableReference("Anchors");
            table.CreateIfNotExists();

            while (true)
            {
                Thread.Sleep(10000);
                Trace.WriteLine("Working", "Information");
            }
        }


Saad Nawaz on Tue, 22 Jan 2013 00:05:07


Uninstall ODataLib 5.2.0.0 by going to NuGet package manager and uninstalling all components of ODataLib 5.2.0.0 i.e. EdmLib, System.Spatial.

Then open Package Manage Console and enter following command in it:

Install-Package Microsoft.Data.OData -Version 5.0.2

This should resolve the issue.

Gaurav Mantri on Tue, 22 Jan 2013 02:42:22


I'm not 100% sure where, but I saw that installing OData version 5.2.0.0 breaks storage client library. One solution I would recommend is to install Windows Azure Storage Client library from Nuget directly instead of referencing it from the SDK folder using: Install-Package WindowsAzure.Storage in Package Manager console or using Nuget UI (right click on Project --> Manage Nuget Packages). That will ensure all related dependencies are installed as well.

Hope this helps.

DDL19 on Tue, 22 Jan 2013 04:26:28


after adding EDM back in I am now back to unhandled storage exception even with 5.0.2

Could not load file or assembly 'Microsoft.Data.OData, Version=5.0.2.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)

Gaurav Mantri on Tue, 22 Jan 2013 04:56:56


I was able to reproduce the error you're getting. Can you try the following in web.config file:

Find the following lines of declaration in your web.config file:

      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.0.0" newVersion="5.2.0.0" />
      </dependentAssembly>

and replace it with the following:

      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.0.2.0" newVersion="5.0.2.0" />
      </dependentAssembly>
Hope this helps.

DDL19 on Tue, 22 Jan 2013 05:24:10


unfortunately same error yet..... Microsoft really needs to get on this. This is basic stuff that is not working....

Gaurav Mantri on Tue, 22 Jan 2013 05:36:57


While trying to simulate the error you're getting, one thing I noticed is that the application completely removed the reference for Microsoft.Data.OData from the project. Can you check if you can still see a reference for this library in your project?

One thing I would recommend is that using Nuget Package Manager UI (Manage Tab), uninstall WindowsAzure.Storage and then reinstall it again.

Other idea would be to start with a new project and add reference to WindowsAzure.Storage using Nuget Package Manager instead of referencing it from the SDK directly.

If your project implements Windows Azure Diagnostics, you would need to add reference to Microsoft.WindowsAzure.StorageClient library which you can do by adding the reference manually after you've added reference to latest storage client library using Nuget.

I completely agree with you that Microsoft need to fix this experience. At least when we're adding reference to WindowsAzure.Storage from SDK directory, it should add references for the dependencies as well.

Saad Nawaz on Tue, 22 Jan 2013 19:24:45


Hi,

Did you try out the solution I mentioned? i.e. Uninstall ODataLib 5.2.0.0 by going to NuGet package manager and uninstalling all components of ODataLib 5.2.0.0 i.e. EdmLib, System.Spatial.

Then open Package Manage Console and enter following command in it:

Install-Package Microsoft.Data.OData -Version 5.0.2
This should solve the problem. Please give this a try and let me know if this still doesn't work.


DDL19 on Tue, 22 Jan 2013 21:44:48


Saad and Gaurav,

It seemed that the uninstalls were leaving remnants hanging around. I started a new project  and copied over my code and installed the windowsazure package which installed the 5.0.2 version and everything is no working. The 5.2 package corrupts things? Hope Microsoft gets on this because if you follow their steps on the Azure sight it will NOT work..

Thank you both for your help! 

Dan

colmite on Mon, 04 Feb 2013 22:20:24


So I seem to have the same issue. My issue is I need to use both blob storage (table and block) and I am now running into all sorts of issues. I want to be able to run WCF Dataservices 5.2 which requries Odata 5.2 for this. I have the binding redirect in place as well however this still fails. I only upgraded to SDK 1.8 as I was experiencing failures with WCF DataServices 5.2 as i was getting errors related to ambigious namespace. I needed to delete the the system.data.services (i think it was) however that broke writing to tables in azure 1.7. With moving to 1.8 i now have the conflict with oData.

Is anyone else trying to run WCF on Azure? I cant imagine that I am the only one that would like to run WCF 5.2. Any possible insight in how I might resolve this issue?

One other intersting thing I found, If I try to uninstall WCF services from my project along with Odata I get the following:

Unable to uninstall 'Microsoft.Data.OData 5.2.0' because 'WindowsAzure.Storage 2.0.3.0' depend(s) on it.

any help or pointers would be greatly appreciated!

Many thanks!

Jonathan


Scott Colestock on Thu, 07 Feb 2013 20:40:47


I was able to resolve my own problem in this area ("Could not load file or assembly 'Microsoft.Data.OData, Version=5.0.2.0") by removing all project-level packages for storage/odata/edm and starting over with WindowsAzure.Storage 2.0.3.0 at the solution level (and letting it bring in dependencies.)  However, that leaves me with OData/Edm 5.0.2 - which was fine for me but perhaps not for others.

O.G on Thu, 14 Feb 2013 06:45:56


Hi,

You can try this:

  1. Uninstall Microsoft.Data.OData 5.2.0.0 from NuGet package manager
  2. Run "Install-Package Microsoft.Data.OData -Version 5.0.2" in the Package Manager Console (this command installs  the missed dependencies).
  3. Finally, If there is any problem in web.config to references you can do:

Find the following lines of declaration in your web.config file:

	<dependentAssembly>
        	<assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        	<bindingRedirect oldVersion="0.0.0.0-5.2.0.0" newVersion="5.2.0.0" />
      </dependentAssembly>

and replace it with the following:

      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.0.2.0" newVersion="5.0.2.0" />
      </dependentAssembly>

As Gaurav Mantri said.

It's worked for me.


colmite on Mon, 18 Feb 2013 20:36:30


Thanks,

I was able to uninstall all the things and currently able to run Azure 1.7 table and blob storage (i decided to stay at 1.7 since I am also using cloud drive) along with WCF 5.0 (or Odata V2). The biggest problem for me is i would truly like to run Odata V3 as it seems to be the best and suggested version for anything querying the service via JSON. I have plans to consuming the data via HTML 5 application that will run on IOS and Android and the plan is to use jquery mobile in order to achive this. For my product, i can deal with V2 for the time being however just another one of those "gotcha's" that I find i keep running into with azure.

dinwal on Tue, 02 Apr 2013 21:39:43


I am also having the same issue on createIfNotExists call. Tried removing Odata and reinstalling but it did not work. Mine is a large project to copy the code over to a new one. I will appreciate any help on this. Thank you.

Sergiátor on Thu, 11 Apr 2013 13:41:55


Hi there,

having same issue over here. My project has WK which accesses table storage, blob, etc... and I cannot find a solution.

Is MS gonna do things right and sort out this mess at once? Otherwise, will change the technology and leave Azure (I'm totally tired this every-day-azure issues).

Thx.

ctarmor on Wed, 02 Oct 2013 23:26:04


It is October 2013 and I am having the same issue as it was on the previous posts. Every time I update one package, another one stops working.. WTF! I spend more time trying to figure out this annoyances.