s_h
s_h

Reputation: 1496

error with @MvcHtmlString.Create(...)) - system.web.mvc

I create a new asp.net mvc 4 version and include dotnetopenauth implementation from Nerddinner project into it.

registration and authentication using formsauthentication works ok. On the other hand when I include Logon details for openauth - logonopenid.cshtml - implementation I received an error:

"Could not load file or assembly 'System.Web.Mvc, Version=1.0.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) "

Source Error:

Line 38: @MvcHtmlString.Create(Html.OpenIdSelectorScripts(options, 
null)) 

I checked and I´m using system.web.mvc version= 4 and includes a definition for mvchtmlstring and html helpers includes a definition for openidselectorscripts. truly I dont know why is requesting assembly 1.0.0. any help will be appreciated. brgds, sebastian.

Upvotes: 1

Views: 1233

Answers (2)

Andrew Arnott
Andrew Arnott

Reputation: 81791

You need to add this to your web.config file:

<runtime>
    <!-- When targeting ASP.NET MVC 4, this assemblyBinding makes MVC 1 references relink
         to MVC 4 so libraries such as DotNetOpenAuth that compile against MVC 1 will work with it. -->
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="4.0.0.0" />
        </dependentAssembly>
    </assemblyBinding>
</runtime>

Upvotes: 2

jim tollan
jim tollan

Reputation: 22485

sebastian_h,

I've seen this happening before. 'distant' memory recalls the issue being related to entries in the web.config that is located under the /Views folder (as opposed to the root web.config file).

I may be way off here, but this rings a bell. Certainly worth a quick peek.

Upvotes: 1

Related Questions