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

Closed

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.

Activity

  1. pranavkm commented on Jun 21, 2017

    @pranavkm
    Contributor

    Dupe of #6308

  2. pranavkm commented on Jun 21, 2017

    @pranavkm
    Contributor

    Actually no, this is different 👍

  3. added this to the 2.0.0 milestone on Jun 22, 2017
  4. added a commit that references this issue on Jun 22, 2017
    2de7fc8
  5. added 2 commits that reference this issue on Jun 26, 2017
    6d1ae9d
    efb65e3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions