title: MVC - Cannot resolve view (controllers and views in separate projects)
body: <p>I have a Solution with 4 projects:</p>
  
  <ul>
  <li><code>AS.Core.Common</code> (references: Data, Web)</li>
  <li><code>AS.Core.Controllers</code> (references: Common, Data, Web)</li>
  <li><code>AS.Core.Data</code></li>
  <li><code>AS.Core.Web</code> (references: Data)</li>
  </ul>
  
  <p>In my controllers, anywhere that I return a view:</p>
  
  <blockquote>
    <p>return View("~/Views/Home/Index.cshtml");</p>
  </blockquote>
  
  <p>It is highlighted in red and I get a <code>"Cannot resolve view '~/Views/Home/Index.cshtml'"</code>.</p>
  
  <p>All four projects build successfully but when I hit F5 I get the following:</p>
  
  <blockquote>
    <p>Server Error in '/' Application.</p>
    
    <p>The resource cannot be found.</p>
    
    <p>Description: HTTP 404. The resource you are looking for (or one of its
    dependencies) could have been removed, had its name changed, or is
    temporarily unavailable.  Please review the following URL and make
    sure that it is spelled correctly. </p>
    
    <p>Requested URL: /</p>
    
    <p>Version Information: Microsoft .NET Framework Version:4.0.30319;
    ASP.NET Version:4.0.30319.17929</p>
  </blockquote>
  
  <p>How can I get my controllers to see my views so they resolve properly? I'm assuming this is why I get the 404 response.</p>
  
  <p>My <code>Global.asax.cs</code> look like so:</p>
  
  <pre><code>public class MvcApplication : System.Web.HttpApplication
  {
      protected void Application_Start()
      {
          // Register the default hubs route: ~/signalr
          RouteTable.Routes.MapHubs();
  
          AreaRegistration.RegisterAllAreas();
  
          WebApiConfig.Register(GlobalConfiguration.Configuration);
          FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
          RouteConfig.RegisterRoutes(RouteTable.Routes);
          BundleConfig.RegisterBundles(BundleTable.Bundles);
      }
  }
  </code></pre>
  
  <p>My <code>RouteConfig.cs</code> (I added namespaces but it appears to have not helped)</p>
  
  <pre><code>public static void RegisterRoutes(RouteCollection routes)
  {
      routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
  
      routes.MapRoute(
          name: "Default",
          url: "{controller}/{action}/{id}",
          namespaces: new[] { "AS.Core.Controllers" },
          defaults: new 
          {
              controller = "Home", 
              action = "Index", 
              id = UrlParameter.Optional
          });
  }
  </code></pre>
  
  <p>This is my <code>HomeController.cs</code></p>
  
  <pre><code>public class HomeController : Controller
  {
      public ActionResult Index()
      {
          //return View("~/Views/Home/Index.cshtml");
          return View();
      }
   }
  </code></pre>