This project is read-only.

Is it compatible with the Framework 4.5?

Sep 17, 2012 at 2:01 PM
Edited Sep 17, 2012 at 2:07 PM

Hi...

I have an existing MVC4 application that runs on the 4.5 framework.

I added to my solution a new MVC4 web app (with the 4.5 framework too) with one precompiled view (I added the reference to the RazorGenerator.Mvc package) but when I add the reference to my main project I have this error:

"Attempted to access an element as a type incompatible with the array."
Line 15:             ViewEngines.Engines.Insert(0, engine);

Is it possible that the RazorGenerator package is not compatible with the 4.5 framework?

Thanks
valse 

Edit: I updated the WebActivator package on the common view MVC web app to the 1.5.1 version and now it works!

Coordinator
Sep 17, 2012 at 5:24 PM

Strange, I just tried created a new MVC4 Fx 4.5 app and enabled RazorGenerator, and it seems to work fine without updating WebActivator. Not sure what the deal was, but glad you now have it working!

Sep 18, 2012 at 8:34 AM

Hi davidebbo...

I have another question: if I have a Test folder controller with an Index view on my external view library and I have the same folder and view on my main project how can I use this one instead the external version?

I have 5 sites that have some common views and so I made a common "site" that compile these same views and I add a reference to this project on each other sites.

Thanks
Marco 

Coordinator
Sep 18, 2012 at 8:48 AM

If you look at the RazorGeneratorMvcStart (added by the NuGet package), you can change the order in which the view engine is inserted, so you can pick which one gets used first.

Sep 18, 2012 at 11:54 AM
Edited Sep 18, 2012 at 11:54 AM
davidebbo wrote:

If you look at the RazorGeneratorMvcStart (added by the NuGet package), you can change the order in which the view engine is inserted, so you can pick which one gets used first.

OMG... thanks... I change the Insert method (on top of the view engine array) with the Add one :-p

 

ViewEngines.Engines.Add(engine);
Sep 18, 2012 at 2:05 PM

The update of WebActivator package didn't the solution of my first issue... My main MVC app start working because I re-installed one of packages of the external view project.

I added the reference to another of my main site and I have the same issue:

"Attempted to access an element as a type incompatible with the array." 

but if I uninstall and re-install the RazorGenerator.MVC package on my external view project it works.

I can't understand why...?!