general System.Web.Razor error (also Postal project) - asp.net-mvc-4

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.

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.

New MVC4 solution, adding Piranha CMS, missing assembly

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

Could not load file or assembly Telerik.Sitefinity

having some issues upgrading my Sitefinity 4.1.1339.0 installation to 4.3 (and ultimately to Sitefinity 5). It is giving me the following error:
Could not load file or assembly 'Telerik.Sitefinity, Version=4.1.1339.0, Culture=neutral, PublicKeyToken=b28c218413bdf563' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I was thinking it was the /bin/Telerik.Sitefinity.dll file but everything seems to be updated in there.
Any ideas?
Thanks!
I agree with #Josh, plus you might try looking through all your files in the App_Data\Sitefinity\Configuration folder. I had to update all of the references in those files manually for some reason to match the exact DLL version. Make sure you completely restart your cassini/IIS/sitefinity instance to pick up the changes.
If you are using 'assemblyBinding' in your Sitefinity web.config, you will need to update that section of the config to the latest dll versions. Assembly Binding is a common solution to map out of date third party Sitefinity modules/plugins to the current Sitefinity dlls.
The following are correct versions for Sitefinity 5.1.3210. Note that Telerik.Web.UI is a different version as it is from a different Telerik product line.
<!-- From web.config - not complete file -->
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Telerik.Sitefinity" publicKeyToken="b28c218413bdf563" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="5.1.3210.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Telerik.Sitefinity.Model" publicKeyToken="b28c218413bdf563" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="5.1.3210.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Telerik.Web.UI" publicKeyToken="121fae78165ba3d4" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="2012.2.607.40"/>
</dependentAssembly>
</assemblyBinding>
If you will be upgrading through many versions 4.1 -> 4.4 -> 5.0 -> 5.1, you may wish to comment out this section of the config until you are complete with your upgrades, then add it back in. Otherwise, you'll have to edit these three lines after each upgrade.
Note: to get the dll version, browse to the bin folder. Right click dll file, click properties, then select the 'details' tab.