Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

Razor Pages do not pick up changes to _ViewImports.cshml outside of the Pages directory #6428

@halter73

Description

@halter73

/_ViewImports.cshtml

@namespace TestNamespace

/Pages/TestPage.cshtml

@page

@GetType()

/Views/Home/Index.html

@{
    Layout = null;
}

@GetType()

To reproduce this issue, take the following steps:

  • Ensure all the files listed above are in your MVC 2.0.0-preview2 project.
  • Launch the web project from VS. I was debugging the app while doing the following steps, but I don't think debugging is necessary to repro the issue.
  • Verify that the initial response for http://example/ is TestNamespace.Views.Home.Index_View and the initial output for http://example/TestPage is TestNamespace.Pages.TestPage_Page.
  • Without stopping the app, edit the namespace to /_ViewImports.cshtml to something other than TestNamespace like NewNamespace.
  • Verify that the initial response for http://example/ has now changed to NewNamespace.Views.Home.Index_View as expected.
  • Note that the response for http://example/TestPage has not changed to NewNamespace.Pages.TestPage_Page. Instead it's still TestNamespace.Pages.TestPage_Page

If you restart the app or modify TestPage.cshtml, the namespace changes will be picked up.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions