none
Storage Exception Could not load file or Assembly 'Microsoft.Data.Odata

    Question

  • 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?

    Monday, January 21, 2013 11:05 PM

Answers

  • 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.


    • Edited by O.G Thursday, February 14, 2013 6:57 AM
    • Marked as answer by DDL19 Monday, February 18, 2013 5:42 PM
    Thursday, February 14, 2013 6:45 AM
  • 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.

    • Marked as answer by DDL19 Tuesday, January 22, 2013 9:40 PM
    Tuesday, January 22, 2013 5:36 AM
  • 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.



    Saad Nawaz
    SDET
    Windows Azure Tools for Microsoft Visual Studio

    This posting is provided "AS IS" with no warranties, and confers no rights.

    • Marked as answer by DDL19 Tuesday, January 22, 2013 9:40 PM
    Tuesday, January 22, 2013 7:24 PM

All replies

  • 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.


    Saad Nawaz
    SDET
    Windows Azure Tools for Microsoft Visual Studio

    This posting is provided "AS IS" with no warranties, and confers no rights.

    • Proposed as answer by abc1234defgh Wednesday, September 30, 2015 7:56 PM
    Monday, January 21, 2013 11:33 PM
  • OData, EDM and Spatial are all installed...
    Monday, January 21, 2013 11:39 PM
  • These are installed at the Worker role level where they are used. should this be at the higher Solution level?
    Monday, January 21, 2013 11:49 PM
  • 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");
                }
            }


    Tuesday, January 22, 2013 12:00 AM
  • 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.


    Saad Nawaz
    SDET
    Windows Azure Tools for Microsoft Visual Studio

    This posting is provided "AS IS" with no warranties, and confers no rights.

    Tuesday, January 22, 2013 12:05 AM
  • 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.

    Tuesday, January 22, 2013 2:42 AM
  • 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)

    Tuesday, January 22, 2013 4:26 AM
  • 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.

    Tuesday, January 22, 2013 4:56 AM
  • unfortunately same error yet..... Microsoft really needs to get on this. This is basic stuff that is not working....
    Tuesday, January 22, 2013 5:24 AM
  • 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.

    • Marked as answer by DDL19 Tuesday, January 22, 2013 9:40 PM
    Tuesday, January 22, 2013 5:36 AM
  • 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.



    Saad Nawaz
    SDET
    Windows Azure Tools for Microsoft Visual Studio

    This posting is provided "AS IS" with no warranties, and confers no rights.

    • Marked as answer by DDL19 Tuesday, January 22, 2013 9:40 PM
    Tuesday, January 22, 2013 7:24 PM
  • 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

    Tuesday, January 22, 2013 9:44 PM
  • 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


    • Edited by colmite Monday, February 4, 2013 10:36 PM
    Monday, February 4, 2013 10:20 PM
  • 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.
    Thursday, February 7, 2013 8:40 PM
  • 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.


    • Edited by O.G Thursday, February 14, 2013 6:57 AM
    • Marked as answer by DDL19 Monday, February 18, 2013 5:42 PM
    Thursday, February 14, 2013 6:45 AM
  • 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.

    Monday, February 18, 2013 8:36 PM
  • 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.
    Tuesday, April 2, 2013 9:39 PM
  • 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.

    Thursday, April 11, 2013 1:41 PM
  • 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.
    Wednesday, October 2, 2013 11:26 PM