2

I am getting this error:

Assembly 'Microsoft.Web.WebPages.OAuth, Version=3.0.0.0, Culture=neutral, 
PublicKeyToken=31bf3856ad364e35' uses 'WebMatrix.WebData, Version=3.0.0.0, 
Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version 
than referenced assembly 'WebMatrix.WebData, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35'
  1. I have followed this post Could not load file or assembly 'WebMatrix.Data` from the stack overflow and installed it

    PM> Install-Package WebMatrix.Data but not working.

  2. then i deleted packages folder and restore it that also not working.

  3. I tried the following:

    PM> Uninstall-package Microsoft.AspNet.WebPages.OAuth then installed it again.that's also not working.

First thing notice able, if I tried to install the nuget packages seperately----

 PM> Install-Package WebMatrix.WebData

and

PM> Install-Package WebMatrix.Data

Then its providing me only this vrsion 2.0.30506

enter image description here

I don't know how to resolve this issue. The web.config file is something like this.

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

Community
  • 1
  • 1
neo
  • 164
  • 1
  • 17
  • possible duplicate of [Error CS1705: "which has a higher version than referenced assembly"](http://stackoverflow.com/questions/9219832/error-cs1705-which-has-a-higher-version-than-referenced-assembly) – Linda Lawton - DaImTo Sep 14 '15 at 07:18
  • I have tried this http://robertgreiner.com/2014/06/assembly-uses-version-which-has-a-higher-version-than-referenced-assembly-error/ But problem is not fully gone.Now, its stating following message---------Could not load file or assembly 'WebMatrix.Data' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) – neo Sep 15 '15 at 04:22
  • I'm having the exact same issue. No luck with a solution? I don't understand how the OAuth package could be using WebMatrix.WebData version 3 because this version just doesn't exist anywhere. – Emmanuel Jun 22 '16 at 20:33

2 Answers2

1

take a look at Nuget listing for WebMatrix.WebData and WebMatrix.Data

https://www.nuget.org/packages/WebMatrix.Data/

https://www.nuget.org/packages/WebMatrix.WebData/

notice that they were

last updated on Friday, May 31, 2013

These assemblies were moved into

Microsoft ASP.NET Web Pages Data 3.2.3 https://www.nuget.org/packages/Microsoft.AspNet.WebPages.Data/

Microsoft ASP.NET Web Pages Web Data 3.2.3 https://www.nuget.org/packages/Microsoft.AspNet.WebPages.WebData/

Because the names of the assembly names have remained the same, but the locations have changes, Nuget Package Manager gets confused -- failing to correctly add / remove the references from your project.


What to do?

  • in references, remove any reference to WebPages.Data and/or WebPages.WebData
  • in package manager, run

Install-Package Microsoft.AspNet.WebPages.WebData

Install-Package Microsoft.AspNet.WebPages.Data

  • in your Web Project, right click on "references" -> click "Add reference" -> click "Browse..." navigate in your packages directory to packages\Microsoft.AspNet.WebPages.Data.3.2.3\lib\net45 double click WebMatrix.WebData.dll
  • in your Web Project, right click on "references" -> click "Add reference" -> click "Browse..." navigate in your packages directory to packages\Microsoft.AspNet.WebPages.Data.3.2.3\lib\net45 double click WebMatrix.Data.dll

finally:

in your Web.config, remove or comment out any references to dependentAssembly named WebMatrix.Data and/or WebMatrix.WebData

Re-build and run

Dave Alperovich
  • 32,320
  • 8
  • 79
  • 101
  • I've followed your instructions and now I get "The type or namespace name 'WebMatrix' could not be found (are you missing a using directive or an assembly reference?)" – Emmanuel Jun 23 '16 at 14:42
  • @Emmanuel, please expand on this. Are you getting error during build? If so, when you double click on error, is there a using statement for `WebMatrix`? – Dave Alperovich Jun 23 '16 at 14:49
  • Correct, this is a build error and it goes to the statement using WebMatrix.WebData. – Emmanuel Jun 23 '16 at 15:01
  • I thought the problem was because the Package Microsoft.AspNet.WebPages.WebData was not installed properly, so I uninstalled and re-installed it (along with all the dependent packages). Now I get the following error at run time: Could not load file or assembly 'WebMatrix.Data, Version=3.0.0.0..." – Emmanuel Jun 23 '16 at 15:04
  • 1
    Scratch that last error. After I went through your instructions again with the references updated to the latest version, this error seems to be gone. – Emmanuel Jun 23 '16 at 15:12
  • As a matter of fact, I was able to remove all errors! So that was the issue all along. Still your answer was extremely useful to find the root of the problem. Thanks! – Emmanuel Jun 23 '16 at 15:17
1

So the problem was: the package Microsoft.AspNet.WebPages.WebData was not installed properly, so I uninstalled and re-installed it (along with all the dependent packages).

To do this, I ran:

Uninstall-Package Microsoft.AspNet.WebPages.OAuth  
Uninstall-Package DotNetOpenAuth.AspNet  
Uninstall-Package DotNetOpenAuth.OAuth.Consumer 
Uninstall-Package DotNetOpenAuth.OAuth.Core 
Uninstall-Package DotNetOpenAuth.OpenId.RelyingParty 
Uninstall-Package DotNetOpenAuth.OpenId.Core  
Uninstall-Package DotNetOpenAuth.core 
Uninstall-Package Microsoft.AspNet.WebPages.WebData 

Install-Package Microsoft.AspNet.WebPages.WebData 
Install-Package DotNetOpenAuth.core 
Install-Package DotNetOpenAuth.OAuth.Core 
Install-Package DotNetOpenAuth.OpenId.RelyingParty 
Install-Package DotNetOpenAuth.OpenId.Core  
Install-Package DotNetOpenAuth.OAuth.Consumer 
Install-Package DotNetOpenAuth.AspNet  
Install-Package Microsoft.AspNet.WebPages.OAuth  

I then used the instructions from Dave Alperovich above to add the correct version of the references. Now the error is gone.

Emmanuel
  • 16,791
  • 6
  • 48
  • 74