I can't find (by string search) any references to the files in my Pages/Shared
folder anywhere in my project, but if I remove the folder and its files my test page stops loading correctly. Clearly some kind of implicit convention is at work, but I'm unversed on this matter. Where can I find the relevant information on this?
CodePudding user response:
Files in the Pages/Shared
folder are used for reusable parts. The reference, as it is shared throughout the app, is made only by filename or relative path from shared subfolder and without using extension.
You should have in shared folder _Layout.cshmtl
and _Layout.cshtml.cs
at least. That file is defining layout that is used by default on every page you create.
Once you search for "_Layout" in you project you should get at least one result.
Information about project files for Razor pages are available in Examine the project files and about the layout you can find in Layout in ASP.NET Core.
That might give you an idea how it works by default or what is purpose of said folder and file(s).
You can also read and follow instructions in Understand Searched Locations For The Razor View Engine And ASP.NET to get a bit more understanding how it all works by default.