0

I just created a new MVC4 site, pressed run to see that it works, and then ran the command:

Install-Package PiranhaCMS.Mvc

And then pressed run again. This results in the following error being displayed:

Could not load file or assembly 'DotNetOpenAuth.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I tried all highvoted solutions from this thread, except the ones which involved removing OAuth (because I want to use it).

I tried:

  • Remove bin and obj folders.
  • Reinstalling Oauth with Install-Package Microsoft.AspNet.WebPages.OAuth
  • Clean solution ( in combination with the two other options )

Still no luck, any ideas?

EDIT 1:

Im noticing that the installation made some changes to my Web.config regarding the versions of OpenAuth assemblies.

Original:

  <dependentAssembly>
    <assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" />
    <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.1.0.0" />
  </dependentAssembly>

New

  <dependentAssembly>
    <assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" />
    <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
  <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /><assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" /></dependentAssembly>

I'm guessing Piranha is changing what MVC4 is assuming is available but not the dlls themselves??

EDIT 2

It looks like Piranha has removed the 1 from several dependentAssembly nodes (like in my edit above). Question is if I can just change them back or if that will break Piranha instead...

EDIT 3

Pasting back the old values removed the problem.. and my site is now displaying an install new website screen. Still not sure if this has broken anything else though.

Replaced the content of with this in the web.config:

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" />
        <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.1.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780ccd10d57b246" />
        <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.1.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

Also had to comment out the line

<!--<forms loginUrl="~/Account/Login" timeout="2880" />-->:

If anyone knows what is actually wrong and if my "fix" is a good solution that would be a great answer..

Community
  • 1
  • 1
JensB
  • 6,663
  • 2
  • 55
  • 94

1 Answers1

1

Piranha CMS itself doesn't use ASP.NET Identity so just like you noticed it has to do with the runtime assembly bindings. NuGet 2.7 had a bug which caused the runtime bindings to go missing from the web.config when installing the ASP.NET MVC packages. This caused the application to crash when having multiple versions of Razor/WebPages/MVC installed on the local machine (http://piranhacms.org/installing-piranha-cms-with-nuget-27).

To adress this issue, i.e save me from too much support, these missing lines were added into the web.config.transform of the Piranha NuGet-package.

My guess is that the new release of NuGet has adressed these issues and you're getting some form of conflict in the bindings, so you're approach to replace the modified lines with the original is correct.

I'll see if I can release a service release on NuGet for 2.1.x with the runtime bindings removed from the NuGet-package.

Regards

/ Håkan

Håkan Edling
  • 2,723
  • 1
  • 12
  • 15