title: Import namespace globally in ASP.NET views without @using
body: <p>In my ASP.NET MVC 5 Application I have all my models in the namespace <code>MyApp.Models</code>. To use the model inside my view, e.g. to tell the view which model he should use with <code>@model UserLoginModel</code>, I have to import the namespace with <code>using MyApp.Models</code>.</p>
  
  <p>Thats not a big deal but I would prefer it to include this namespace automatically in every of my views to avoid redundant importing in every view. I found out that the web.config file in my views-folder seems to be right for this job</p>
  
  <pre><code>&lt;system.web.webPages.razor&gt;
  &lt;host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /&gt;
  &lt;pages pageBaseType="System.Web.Mvc.WebViewPage"&gt;
    &lt;namespaces&gt;
      &lt;add namespace="System.Web.Mvc" /&gt;
      &lt;add namespace="System.Web.Mvc.Html" /&gt;
      &lt;add namespace="System.Web.Routing" /&gt;
      &lt;add namespace="System.Web.Optimization"/&gt;
      &lt;add namespace="MyApp" /&gt;
      &lt;add namespace="MyApp.Models"/&gt;
    &lt;/namespaces&gt;
  &lt;/pages&gt;
  </code></pre>
  
  <p></p>
  
  <p>But its not working. All of this was pre-generated by Visual Studio. I only added the <code>&lt;add namespace="MyApp.Models"/&gt;</code> for my models. </p>
  
  <p>On SO I found a <a href="https://stackoverflow.com/questions/28719298/add-namespace-to-all-views-in-asp-net-mvc-6">similar question</a> like my but the asker only say that it should work by using the <code>Views/web.config</code> file as I tried and the answears follow his question which is specified to the new beta of ASP.NET MVC 6. But I'm using MVC 5.1.2 and cant get make this work, he can't find the view without including the namespace with <code>@using</code> in the view. </p>