Click here to Skip to main content
13,293,474 members (54,934 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


4 bookmarked
Posted 5 Oct 2013

Upgrading S#arp to MVC4

, 5 Oct 2013
Rate this:
Please Sign up or sign in to vote.
How to upgrade S#arp to MVC4

First of all, I can assure you that S#arp will work on MVC4 and I am using Sharp Architecture 2.0.4. We just recently migrated and tested 2 large S#arp projects and it is fully working and is running in production.

Now let's go to the details, I guess you came across this article either because you want to use MVC4 with your S#arp project or you got this “Entry point was not found” error because you recently installed MVC4 on your machine.

1 Entry point was not found

If it's the second reason yes, it is MVC4 doing it and not S#arp your project just auto referenced the latest MVC version. Now to fix that issue, you need to upgrade your S#arp project to use MVC4 this can also be used in any .NET web projects that is using MVC3 so this guide is not specific to S#arp projects. Let's start!

  1. Go to all of your web projects in this case if it's S#arp it's in the presentation layer. You need to replace all instances of:
    System.Web.Mvc, Version=""
    System.Web.WebPages="", Version=""
    System.Web.Helpers="", Version=""
    System.Web.WebPages.Razor="", Version=""


    System.Web.Mvc="", Version=""
    System.Web.WebPages="", Version=""
    System.Web.Helpers="", Version=""
    System.Web.WebPages.Razor="", Version=""

    You can see this in 3 different locations.

    First is in the configSections which means your old web.config lines which looks like this:

    9 Old Config Section

    will become like this:

    10 New Config Section

  2. Next is in system.web.webPages.razor section under host and in system.web under assemblieswhich means your old web.config lines which look like this:

    2 Old config

    will become like this:

    3 New config

    Finally, check also under the views folder, there is one web.config file in there.

    11 Other Web Config

    Old one will be like this:

    12 Other Web Config OLD

    Change it so it looks like this:

    13 Other Web Config NEW

    In the root Web.config file, update or add the following is not yet there:

      <add key="webpages:Version" value="" />
      <add key="PreserveLoginUrl" value="true" />
  3. In Solution Explorer, right-click the project name (if using s#arp it's the {ProjectName}.Web.Mvc) and then select Unload Project. This will unload your project and you can edit what’s in the code behind. Once unloaded, right-click the name again and select Edit {ProjectName}.csproj.

    Find the ProjectTypeGuids element and replace {E53F8FEA-EAE0-44A6-8774-FFD645390401} with {E3E379DF-F4C6-4180-9B81-6769533ABE47}.

    So from this:

    6 Replace GUID

    will become like this:

    7 Replace GUID

    Save and close file you just edited, right-click the project, and then select Reload Project. This will load the project with the new settings.

  4. If the project references any third-party libraries that are compiled using older versions of MVC (definitely S#arp is), then you have to add the following three bindingRedirect elements under the configuration section in your web.config:

    Here is what you need to add:

      <assemblyIdentity name="System.Web.Helpers"
            publicKeyToken="31bf3856ad364e35" />
      <bindingRedirect oldVersion="" newVersion=""/>
      <assemblyIdentity name="System.Web.Mvc"
            publicKeyToken="31bf3856ad364e35" />
      <bindingRedirect oldVersion="" newVersion=""/>
      <assemblyIdentity name="System.Web.WebPages"
            publicKeyToken="31bf3856ad364e35" />
      <bindingRedirect oldVersion="" newVersion=""/>

So it should look like this:

8 Add assembly Binding

Filed under: CodeProject, Configuration, Programming Tagged: ASP.Net MVC, C#, S#arp Architecture


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Raymund Macaalay
Technical Lead
New Zealand New Zealand

You may also be interested in...

Comments and Discussions

QuestionNice article Pin
ngo.long27-Nov-14 22:19
memberngo.long27-Nov-14 22:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.171207.1 | Last Updated 5 Oct 2013
Article Copyright 2013 by Raymund Macaalay
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid