-
Notifications
You must be signed in to change notification settings - Fork 2.1k
_ViewStart.cshtml not picked up when added to the root of the app #6308
Comments
Side-effect of this #6184. RazorPages are rooted to the |
What's the one-liner to change the root of Razor Pages to the root of the project? |
1 |
We decided to make the change to the sub-folder as it seemed more in line with how the rest of MVC structure idioms (folders for Controllers, Views, Models, etc.). We figured we'd get feedback in preview1 and go from there. So far I haven't seen anything convincing me we should change it to the root (which is what I originally started out thinking it should be). |
My only feedback is it adds a step to the getting started demo (creating the directory) and then I hit this issue when trying to share my layout with the MVC views. Not a big enough deal that I would push for changing the default behavior, but I wanted to understand what the downsides were for using the root. |
We do look for shared files in the idiomatic places by default though, including /Views. How often are shared files put in the project root? It's not what our templates have ever done so I'm not sure why we'd default to that. |
And as for the getting started demo, if you're starting from empty, then yes, you need to add a pages folder. I don't think that warrants changing the default though given apps tend to have many more files that benefit from a little organization which is inline with our other defaults. |
@danroth27 says that |
If it's split then for sure, this should be fixed. |
Looks like I can add
_ViewImports.cshtml
to the root of my app so it gets shared across my views and pages, but_ViewStart.cshtml
only gets picked up by pages when it is under the Pages directory.The text was updated successfully, but these errors were encountered: