Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Krishna 22 posts 52 karma points
    Nov 26, 2012 @ 09:53
    Krishna
    0

    Can we use VS 2012 MVC project template with 4.11

    Hello,

    I have been trying to play around with using ASP.NET MVC 4 project templates for running Umbraco 4.11. This is what I have done:

     

     

    • Create an empty ASP.NET MVC 4 project.
    • Download Umbraco 4.11 from http://umbraco.codeplex.com/releases/view/98167
    • Add all the Umbraco folders and files to the MVC project.
    • Inspect and merge the web.config file from Umbraco project to the MVC project.
    • Add the Umbraco dlls (bin folder of Umbraco) as references into the MVC project.
    • Update the defaultRenderingEngine setting in config/umbracoSettings.config from WebForms to Mvc.
    • Run the project for Umbraco installation to start. Follow the steps indicated in the setup.

     

     

    The admin interface works like charm (of cource I had to add <add key="ValidationSettings:UnobtrusiveValidationMode" value="None" /> to appsettings). However when I preview pages, the master layout does not seem to apply

     

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @{
        Layout = "~/Views/Shared/_Layout.cshtml";
    }
    I then added the _ViewStart.cshtml to the Views folder and then I get the error.
    "Unable to cast object of type 'ASP._Page_Views__ViewStart_cshtml' to type 'System.Web.WebPages.StartPage"

     

    I know many of you would be asking the question, why do you have to do this? The answer is, I would like to use KendoUI MVC wrappers. 

    Any help will be greatly appreciated.

    Warm regards,
    Krishna

  • Richard Terris 273 posts 715 karma points
    Nov 27, 2012 @ 09:56
    Richard Terris
    0

    Hi Krishna

    I believe we're only working up to MVC 3 at the minute.

    You should still be able to start an MVC project in VS2012 although the default is 4, but it has to be MVC3 to work with Umbraco.

  • Krishna 22 posts 52 karma points
    Nov 27, 2012 @ 10:48
    Krishna
    0

    Many thanks Richard,

    Yes indeed I tried MVC 4 in the hope I could avoid alttemplate for Mobile site. However I shall try MVC 3.

    Warm regards,
    Krishna

     

     

  • Richard Terris 273 posts 715 karma points
    Nov 27, 2012 @ 10:50
    Richard Terris
    0

    Let me know how it goes - good luck

  • Krishna 22 posts 52 karma points
    Nov 27, 2012 @ 12:07
    Krishna
    0

    Hello Richard,

    Seems to be working. Thanks for your time. Somehow I cannot get KenDoUi MVC wrappers working with it though. 

    Warm regards,
    Krishna

  • Richard Terris 273 posts 715 karma points
    Nov 27, 2012 @ 12:16
    Richard Terris
    0

    Remember to mark the answer as solution in case anyone else has the problem.

    Regarding KendoUI - do you possibly have the dll's for Kendo that compile against MVC4 ? They should have an MVC3 compatible version, which you will now need.

  • Krishna 22 posts 52 karma points
    Nov 28, 2012 @ 07:38
    Krishna
    0

    Hello Richard,

    I did mark it as a solution immediately after my reply.

    Regarding KendoUI, I have sorted it out. Perhaps there was a minor typo. I just copied the code again from their examples and that got it working. 

    Warm regards,
    Krishna

     

  • DavidGrove 4 posts 23 karma points
    Dec 01, 2012 @ 12:37
    DavidGrove
    0

    Hey Krishna, would you mind sharing your MVC-project/soultion? Im trying to the same as you but I cant seem to make it work...

  • Krishna 22 posts 52 karma points
    Dec 01, 2012 @ 19:44
    Krishna
    0

    Hello David,

    Please provide your email address and I can send in the sample project.

    Warm regards,
    Krishna

     

     

  • DavidGrove 4 posts 23 karma points
    Dec 01, 2012 @ 22:51
    DavidGrove
    0

    thanks a lot, you can email me at [email protected]

    thanks again!

  • DavidGrove 4 posts 23 karma points
    Dec 03, 2012 @ 22:20
    DavidGrove
    0

    Krishna, did you forget about me? :)

  • Krishna 22 posts 52 karma points
    Dec 04, 2012 @ 09:15
    Krishna
    0

    Hello David,

    Sorry have been busy but I have now shared the sample project via dropbox.

    Warm regards,
    Krishna
     

  • Sebastiaan Janssen 5045 posts 15477 karma points MVP admin hq
    Dec 04, 2012 @ 11:57
    Sebastiaan Janssen
    1

    To make this a bit easier, I've just created this (make sure to wattch the screencast as well): http://our.umbraco.org/projects/developer-tools/umbraco-visual-studio-project

  • Krishna 22 posts 52 karma points
    Dec 17, 2012 @ 12:17
    Krishna
    0

    Hello Sebastiaan,

    Your solutions indeed looks very clean. However when I tried to add SurfaceControllers in the MVC project (Umbraco.Extensions), the application cannot resolve the views. Of course this is expected but have you tried anything like "VirtualPathProvider" or would you advise just copying the view into the CMS project (Umbraco.Site) on very build. 

    Warm regards,
    Krishna

  • Sebastiaan Janssen 5045 posts 15477 karma points MVP admin hq
    Dec 17, 2012 @ 13:22
    Sebastiaan Janssen
    0

    @Kirshna I have an example with a very simple SurfaceController over here: https://dl.dropbox.com/u/3006713/SurfaceController4111.zip

Please Sign in or register to post replies

Write your reply to:

Draft