Guest User

Untitled

a guest
Jul 30th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.11 KB | None | 0 0
  1. // part of Global.asax.cs
  2. // R# cannot resolve ~/Views/CloudTransporter/EdiDestinationConfig/Index.cshtml
  3.  
  4. protected void Application_Start(object sender, EventArgs eventArgs)
  5. {
  6.     MvcHandler.DisableMvcResponseHeader = true;
  7.     RouteTable.Routes.MapRoute("Default", "{controller}/{action}", new { controller = "Home", action = "Index" });
  8.     var container = BuildContainer();
  9.     DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
  10.     AddCloudTransporterViewsLocations(ViewEngines.Engines);
  11. }
  12.  
  13. private static void AddCloudTransporterViewsLocations(ICollection<IViewEngine> engines)
  14. {
  15.     var razorEngine = engines.OfType<RazorViewEngine>().FirstOrDefault();
  16.  
  17.     if (razorEngine == null)
  18.         return;
  19.     razorEngine.ViewLocationFormats =
  20.         razorEngine.ViewLocationFormats.Concat(new []
  21.         {
  22.             "~/Views/CloudTransporter/{1}/{0}.cshtml"
  23.         }).ToArray();
  24.  
  25.  
  26.     razorEngine.PartialViewLocationFormats =
  27.         razorEngine.PartialViewLocationFormats.Concat(new []
  28.         {
  29.             "~/Views/CloudTransporter/{1}/{0}.cshtml"
  30.         }).ToArray();
  31. }
Advertisement
Add Comment
Please, Sign In to add comment