Runtime error there is no build provider registered for the extension '.cshtml'

asp.net-mvc

Solution

This solved the problem for me.

Change this in `Web.config`

<compilation debug="true" targetFramework="4.5.1" optimizeCompilations="true" />

to

<compilation debug="true" targetFramework="4.5.1" optimizeCompilations="false" />

ADDED: when after a few minutes I back web.config to old, the problem not repeated. strange things )

Problem

I get the following error when I try to run one of my scaffolded views in mvc 4: Server Error in '/' Application. There is no build provider registered for the extension '.cshtml'. You can register one in the section in machine.config or web.config. Make sure is has a BuildProviderAppliesToAttribute attribute which includes the value 'Web' or 'All'. The only answers I have found relate to intellisense but my code complies fine and breaks at runtime. This is a strange error as I am not using a class library. There is just one controller that gives this message on all of its views, all other controllers/views work fine.

Original source

Related problems