{
  "id": "dotnet/razor-pages-view-engine-missing-file",
  "signature": "InvalidOperationException: The view 'Index' was not found. The following locations were searched: /Views/Home/Index.cshtml, /Views/Shared/Index.cshtml, /Pages/Home/Index.cshtml",
  "signature_zh": "InvalidOperationException: 未找到视图'Index'。已搜索以下位置：/Views/Home/Index.cshtml, /Views/Shared/Index.cshtml, /Pages/Home/Index.cshtml",
  "regex": "The view '.+' was not found\\. The following locations were searched:",
  "domain": "dotnet",
  "category": "build_error",
  "subcategory": null,
  "root_cause": "The Razor view engine cannot locate the specified view file because the file is missing, the path is incorrect, or the view has not been compiled (e.g., due to a missing @page directive or incorrect folder structure).",
  "root_cause_type": "generic",
  "root_cause_zh": "Razor视图引擎无法找到指定的视图文件，因为文件缺失、路径不正确或视图未编译（例如由于缺少@page指令或文件夹结构错误）。",
  "versions": [
    {
      "version": ".NET 6.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": ".NET 7.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": ".NET 8.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "ASP.NET Core MVC 6.0+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Razor Pages 6.0+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Adding a view file with the same name but in a different folder (e.g., /Views/Shared/Index.cshtml instead of /Views/Home/Index.cshtml)",
      "why_fails": "The view engine searches specific locations based on controller name; a shared view may not be picked up if the controller expects a specific view.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "Setting the view location format in Startup.cs to include custom paths without ensuring the actual file exists",
      "why_fails": "The custom path is searched, but if the file is still missing, the error persists.",
      "fail_rate": 0.3,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Create the missing view file at the correct location: /Views/{ControllerName}/{ActionName}.cshtml (e.g., /Views/Home/Index.cshtml) with the required Razor content.",
      "success_rate": 0.95,
      "how": "Create the missing view file at the correct location: /Views/{ControllerName}/{ActionName}.cshtml (e.g., /Views/Home/Index.cshtml) with the required Razor content.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If using Razor Pages, ensure the page is in /Pages folder and has an @page directive at the top, with a matching route.",
      "success_rate": 0.85,
      "how": "If using Razor Pages, ensure the page is in /Pages folder and has an @page directive at the top, with a matching route.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Create the missing view file at the correct location: /Views/{ControllerName}/{ActionName}.cshtml (e.g., /Views/Home/Index.cshtml) with the required Razor content.",
    "If using Razor Pages, ensure the page is in /Pages folder and has an @page directive at the top, with a matching route."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://learn.microsoft.com/en-us/aspnet/core/mvc/views/overview?view=aspnetcore-8.0",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.82,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2023-01-25",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}