Making namespace available across all MVC Razor views

If you are intending to use the same namespace across multiple views, just include it in the web.config of the Views folder. In the following example I wanted the MyProject.WebUI.Properties namespace to be available to all views. The removes the need to add the using statement for this namespace to every view. Please note, once you’ve added the namespace you’ll need to close and reopen any open view files for intellisence to recognize the namespace.

    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="MyProject.WebUI.Properties" />