Skip to content
This repository has been 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

Closed
halter73 opened this issue Jun 21, 2017 · 2 comments
Assignees
Milestone

Comments

@halter73
Copy link
Member

halter73 commented Jun 21, 2017

/_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.

@pranavkm
Copy link
Contributor

Dupe of #6308

@pranavkm
Copy link
Contributor

Actually no, this is different 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants