简体   繁体   中英

OAuth.dll using higher version than referenced assembly of webMatrix.data and webmatrix.webdata

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

在此处输入图片说明

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" />

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM