2

I added MVC to my existing Web Forms project, but then when I try to add MVC razor page I got this rutime error:

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'.

Answer to similar question Razor Compiler Warning/Errors - ASP.NET MVC 4 gave me a hint, so I fixed that run-time crash by modifying root Web.Config. I added to element this code:

<assemblies>
    <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>

That helped.

Then I removed that "assemblies" configuration, but my web project kept working.

Why razor crashed initially and why does it work now?

Update: I noticed that this error happened on Windows 7 computers, but did not happen on Windows 8 computers.

Community
  • 1
  • 1
Dennis Gorelik
  • 1,234
  • 1
  • 11
  • 15

0 Answers0