Important!! .Net 4 / Net 4.5

213 views
Skip to first unread message

Michael Edwards

unread,
Jan 12, 2014, 3:51:21 AM1/12/14
to glass...@googlegroups.com, glasssite...@googlegroups.com
Hi Everyone

Yesterday Arpana reported an error using Glass.Mapper in Sitecore 7.1. After some investigation it turned out that this problem was caused because Glass.Mapper was compiled against the MVC3 assemblies and the binding redirects trick wasn't enough to solve the problem of getting Glass.Mapper working with MVC4.

I have a solution which is that I create two builds of Glass.Mapper, the first uses .Net 4 and MVC 3, the second uses .Net 4.5 and MVC 4.

The .Net 4 versions can be used with all Sitecore releases pre 7.1 and the .Net 4.5 version can be used with Sitecore 7.1. You won't have to worry about which to download from Nuget because both versions are contained in the same Nuget package and Nuget sorts out which to install based on the project configuration. 

However this creates a problem for anyone who is using Glass + Sitecore pre 7.1 + Net 4.5. When you download the Nuget package Nuget will try to install the .Net 4.5 versions which points at MVC4. This will then give you a compile error because your solution reference MVC3. You can manually change the references but this is still a pain.

How many people would this affect? Does anyone know of a better solution?

Mike

Kyle Heon

unread,
Jan 12, 2014, 7:44:52 AM1/12/14
to glasssite...@googlegroups.com
It would affect me. We are on 7.0 Update 2 with the MVC hot fix from Sitecore.

Michael Edwards

unread,
Jan 12, 2014, 11:07:20 AM1/12/14
to glasssite...@googlegroups.com
Kyle 

What does the MVC hotfix do?

Mike


On 12 January 2014 12:44, Kyle Heon <kyle...@gmail.com> wrote:
It would affect me. We are on 7.0 Update 2 with the MVC hot fix from Sitecore.

--
You received this message because you are subscribed to the Google Groups "Glass.Sitecore.Mapper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to glasssitecorema...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Kyle Heon

unread,
Jan 12, 2014, 1:18:17 PM1/12/14
to glasssite...@googlegroups.com
It provided some patched MVC assemblies to support MVC4. Works with Update 2 but they said Update 3 was untested so I stuck with Update 2. I tried 7.1 with MVC4 support baked in but the UI doesn't support IE11 so had to downgrade.
You received this message because you are subscribed to a topic in the Google Groups "Glass.Sitecore.Mapper" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/glasssitecoremapper/diHSf964S54/unsubscribe.
To unsubscribe from this group and all its topics, send an email to glasssitecorema...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.


--
Kyle Heon
kyle...@gmail.com
www.flickr.com/photos/kyleheon/
www.facebook.com/kyleheon/
www.twitter.com/kyleheon/
www.linkedin.com/in/kyleheon/

Michael Edwards

unread,
Jan 12, 2014, 1:44:23 PM1/12/14
to glasssite...@googlegroups.com
So you are running on MVC4 with .NET 4.5? If so then you  will be ok. The will only cause problems for those using MVC3 with .NET 4.5.

Mike

Michael Edwards

unread,
Feb 4, 2014, 7:52:30 AM2/4/14
to Benjamin Lipson, glass...@googlegroups.com, glasssite...@googlegroups.com
Ben

Unfortunately I don't have access to a machine that  doesn't have .NET4.5 installed on it. 

One thing you could try is removing the WebActivator references, I have something in the back of my mind telling me that this might have been causing the problem.

If you do remove it you will need to move the code in the GlassMapperSc to the Global.Application_Start method.

Mike


On 4 February 2014 12:19, Benjamin Lipson <blip...@gmail.com> wrote:
Hi Michael,

My project builds on a machine with .NET 4.5, but the web server only has up to .NET 4.0. The project is a .NET 4.0 project. When I added Glass.Mapper.Sc with the Glass.Mapper.Sc.CastleWindsor with the .NET 4.0 binaries and built it locally it worked fine (my computer has both .NET 4.5 and .NET 4.0). However, on computers without .NET 4.5, the .NET 4.0 assemblies throw an error,
"Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral". I had to roll back my version of glass to 2 to get it to run on the server. 

Is it possible for you to build the .NET 4.0 assembly on a machine without .NET 4.5? This should fix the problem. 


Thanks!
Ben

Tom Dudfield

unread,
Feb 4, 2014, 11:26:46 AM2/4/14
to glasssite...@googlegroups.com, glass...@googlegroups.com, mikeed...@googlemail.com
Will that fix the issue with web activator? For me ditching activator and creating a pipeline fixed it. Version 7.1, .net 4.5.1 and MVC 5 (bleeding edge!)

eg..
<sitecore>
    <pipelines>
      <initialize>
        <processor type="Website.App_Start.GlassMapperSc, Website" />
      </initialize>
    </pipelines>
Reply all
Reply to author
Forward
0 new messages