webpages:Version AppSetting in MVC

Jun 25, 2014

Another application configuration setting you will observe in web.config of your ASP.NET MVC application is webpages:Version

<add key="webpages:Version" value="" />

The value for this setting currently is showing This indicates the version of Webpages - Razor view engine is to be used.

This application setting was introduced during update release of ASP.NET MVC 3 and is used to identify which Razor view engine to be used for handling webpages in your MVC application.

Based on my digging into ASP.NET WebStack codebase on codeplex, Build and Revision component of version number are optional or can differ.

If these two components of version number are not present or not found to be valid System.Web.WebPages.Deployment library fixes it to x.x.0.0 and returns the version number.

What will happen if webpages:Version application settings is removed?

No worries, because a cascade check is used to find webpages:Version number.

First Step: Check in your application root web.config, if not found.

Next Check: Check in bin directory of your application, it will search for System.Web.WebPages.Deployment.dll and extract version number. This will be used / returned when asked for webpages:Version value, if not found.

Next Step: The application will use / return default version number for webpages which is -

Based on above information I believe if we remove this setting, the application will still work as expected (works on my machine), due to the fallback check.

In case if you wish to use specific version of Razor view engine for your application's webpage handling then this setting can come handy.

Happy Coding !!