This project has moved and is read-only. For the latest updates, please go here.

Build failed due to bad project references (MVC 5 etc)


I just cloned, accepted the package restore and built the solution in VS2013 Update 3.

LiveScore-ES - Builds OK.

Debug in IE 11 (Win8.1)

Server Error in '/' Application.

There is no build provider registered for the extension '.cshtml'. You can register one in the <compilation <buildProviders> section in machine.config or web.config. Make sure is has a BuildProviderAppliesToAttribute attribute which includes the value 'Web' or 'All'.
I guessed something in web.config to do with version of WebPages or MVC but the version numbers seemeds to align OK with the version of packages in package.config (and the packages that got downloaded.

I changed Copy Local to 'True' on references:
  • System.Web.Mvc
  • System.Web.Webpages
  • System.Web.Webpages.Razor
Then got this:
Server Error in '/' Application.

Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: An error occurred creating the configuration section handler for system.web.webPages.razor/host: Could not load file or assembly 'System.Web.WebPages.Razor, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Looking at the properties window of each they all seem to be wrong:
  • System.Web.Mvc - (Not as expected)
  • System.Web.Webpages - not
  • System.Web.Webpages.Razor - not
So I deleted references and re-added packages:
  • Uninstall-Package Microsoft.AspNet.Mvc -Version -Force
  • Uninstall-Package Microsoft.AspNet.Razor -Version -Force
  • Uninstall-Package Microsoft.AspNet.Webpages -Version -Force
  • Install-Package Microsoft.AspNet.Mvc -Version
That seems to fix it.

I could send a pull request - can CodePlex do that?!

The resultant change in files is:

Add -   <package id="Microsoft.Web.Infrastructure" version="" targetFramework="net45" />
A number of lines get changed, some new references, some changes to HintPaths.


rohancragg wrote Oct 9, 2014 at 10:53 AM

I also get similar issues with IBuyStuff-cqrs only a bit worse. Again the project IBuyStuff.Server seems to need MVC5 but references MVC4. The packages.config does not even reference it so I had to add it. I have so far not been able to resolve this.

rohancragg wrote Nov 28, 2014 at 2:05 PM

I just checked out commit 6c2d1674afeb and it all now builds fine - thanks!

I will try the other solutions in due course.

rohancragg wrote Nov 28, 2014 at 4:32 PM

I just tried the other solutions.

Here are my findings at the moment:
  • Merp - restored packages and built OK first time
  • IBuySpy - CQRS and DM - restored packages but failed to build due to version of MVC.
I applied the same fix as I'd applied above (i.e. I ran Install-Package Microsoft.AspNet.Mvc -Version

This fixed the solutions and enabled me to build them.

I've not tried running them yet though ;-)

tdavisjr wrote Jan 4, 2015 at 1:25 AM

If you are trying to run the project and get an Entity Framework error about Model validation and migrations, you have to delete the .mdf file in the App_Data folder and run the program again so it can auto create the database file again. IMHO, this database file should be removed from source control if the default is to auto-create the DB on startup.

Craigmaddie wrote May 11, 2015 at 10:10 AM

I applied the same fix as I'd applied above (i.e. I ran Install-Package Microsoft.AspNet.Mvc -Version

Thanks for that Robin. I was getting error messages about Route and RouteProvider after having cloned the repository. But by installing MVC 5 I was able to fix them.