Table of Contents

Views

The framework extends ASP.NET view discovery so controllers and their views can live together in feature-style folders.

Features

  • Feature-folder support: views are discovered beside their controllers
  • Namespace discovery: controller namespaces are added as view search roots
  • Custom locations: additional view paths can be supplied through FrameworkOptions.ViewLocations
  • Custom expander support: a custom IViewLocationExpander can be added alongside the built-in behavior

Behavior

The framework registers several built-in view search paths automatically:

/{controller}/{view}.cshtml
/{namespaceSegment}/{controller}/{view}.cshtml
/{namespaceSegment}/{controller}/{controller}.cshtml
/{namespaceSegment}/{controller}/Views/{view}.cshtml
/{namespaceSegment}/Views/Shared/{controller}/{view}.cshtml

When the framework discovers a controller namespace, it also registers that namespace segment as a valid view root. This makes folder-based features easy to structure without manually wiring view locations.

Caveats

  • Built-in view paths take priority over custom view paths.
  • View namespace discovery happens as controller metadata is discovered, not during a global startup pass.
  • If controllers live in external assemblies, ApplicationParts configuration may still be needed.
  • The custom ViewLocationExpander runs alongside the built-in expander; both are active.
Tip

Keep a controller and its matching view in the same feature folder to align with the framework’s default conventions and avoid extra configuration.