New MVC4 solution, adding Piranha CMS, missing assembly - asp.net-mvc-4

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).
Could not load file or assembly 'DotNetOpenAuth.Core
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..

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

Related

Using 2 versions of log4net in one application

I have a need to reference 2 different versions of log4net in my application.
An older assembly I am referencing uses log4net-net-1.0.dll version 1.2.0.30507,
whereas my newer dependencies use log4net V1.2.15.
I have tried placing this in the web.config to have my application look in a different folder when trying to find the older log4net dll:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="log4net-net-1.0" publicKeyToken="b4df9eabc7e0e71e" />
<codeBase version="1.2.0.30507" href="log4netv1.2.0\log4net-net-1.0.dll" />
</dependentAssembly>
</assemblyBinding>
</runtime>
But the dll is not getting found.
Is there something else I need to do in order for this to work.

Babaganoush SDK - which version of Sitefinity supported?

Babaganoush SDK - which version of Sitefinity supported?
-- error when used in Sitefinity version - 7.0.5115.0.
Does Babaganoush supports only - 7.0.5100
You need to add an assembly binding for all of the 7.0.5100 assemblies babaganoush is referencing. For example:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Telerik.Sitefinity" publicKeyToken="b28c218413bdf563" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="7.1.5115.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>

Cant start piranha MVC from empty template

I'm trying to make use of piranha CMS.
The manager works fine, but here's what I get when trying to view a page
What can be wrong ? where can I look for issues ?
(I updated all the packages, pulled in latest piranha from nuget "Install-Package PiranhaCMSMvc"
Use VS2013, and a empty project template
My web config http://1drv.ms/1gkxD44
Here's my Route's.
It did Add an extra file with piranha routes instead of overwriting it.
But the code was identical. So I moved it from there to the default Route file
Can you post your routing config... I would think your issue is routing. Comparing my web.config and yours, I notice a few differences... You are targeting 4.5.1 and mine is set to framework 4.5. I also had to set a binding redirect for razor, although maybe this wasn't an issue for you.
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages.Razor"
publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.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>
I think it's worthy of comparison because I have a fresh installation with nothing added by me using the nuget package.
All of that being said, I would look to the routing as it appears it is not redirecting to the home controller. When you run the installation it should have asked you if it could rewrite your routing file. Did you allow it to do so?
Edit:
See my updated comments and example project.

general System.Web.Razor error (also Postal project)

VS 2012, MVC4 app using Postal 0.8.0
When I NuGet install Andrew’s Davey’s Postal 0.8.0 it works on my development machine but when I deploy it I get this error message:
Could not load file or assembly 'System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
I have spent several days trying to get this to work. What is the cause of this problem and how do you fix it?
When you install Postal with NuGet it replaces System.Web.Razor 2.0 with System.Web.Razor 1.0. I had to delete the reference to System.Web.Razor 1.0 and then added back in System.Web.Razor 2.0. You have to additionally set Copy Local to True in the Properties for System.Web.Razor and then rebuild the project. Once I did that VS2012 copied the System.Web.Razor.dll to the deployed bin directory and the problem cleared.
Postal also adds these dependency's to the web.config. I removed them and it still works properly.
<dependentAssembly>
<assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="RazorEngine" publicKeyToken="9ee697374c7e744a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.8.0" newVersion="3.0.8.0" />
</dependentAssembly>
UPDATE 3/3/13
AD has just released Postal v0.8.2 which updated System.Web.Razor to 2.0.
The WebGrease dependency, with the release of ASP.NET and Web Tools 2012.2 (http://www.asp.net/vnext/overview/fall-2012-update) appears to be the default now.

FluentNHibernate 1.1 / Castle 1.1 dependency

I would like to upgrade my FluentNHibernate to version 1.1, but I found out it uses Castle.Core 1.1.
I use Castle.Windsor 1.2 in my app which works with Castle.Core 1.2.
I now need to find a version of Castle.Windsor that uses this earlier version of Castle.Core, but I can't find it anywhere.
What do you recommend I should do?
Wait for a version of FluentNHibernate that uses the latest Castle.Core?
OR build FluentNHibernate 1.1 from source using the latest Castle.Core?
OR downgrade my Castle.Windsor version?
Only NHibernate.ByteCode.Castle.dll and Castle.DynamicProxy2.dll depend on Castle.Core.dll.
You can get them compiled against Castle.Core.dll 1.2 from the Castle ActiveRecord 2.1.1 release.
If you don't want to build FluentNHibernate against the lastest version of Castle, add this to your app.config/web.config file :
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Castle.DynamicProxy2" publicKeyToken="407dd0808d44fbdc" culture="neutral" />
<bindingRedirect oldVersion="2.1.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Castle.Core" publicKeyToken="407dd0808d44fbdc" culture="neutral" />
<bindingRedirect oldVersion="1.1.0.0" newVersion="1.2.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>