Searching paths for ViewComponent in ASP.NET

Viewed 91

In general if we use View("Index"). It will search for views in Views/ControllerName or Views/Shared folder. Likewise if we use Component.InvokeAsync("SomeData") then what are the paths it will search for that viewcomponent

1 Answers

Since it is a component, runtimes will search into components folder as stated below:

  • /Views/{Controller Name}/Components/{View Component Name}/{View Name}
  • /Views/Shared/Components/{View Component Name}/{View Name}
  • /Pages/Shared/Components/{View Component Name}/{View Name}

source: microsoft docs

Related