The following tutorial is based on "Get started with Razor Pages in ASP.NET Core" from docs.microsoft.com.
- Visual Studio 2022 for Mac
- In the Visual Studio for Mac Installer, install the .NET Core target.
- From the Visual Studio for Mac File menu, select New Solution.
- Create a new
ASP.NET Core Web Application
with Web and Console > ASP.NET Core > Web Application. Name the projectRazorPagesMovie
.
- Select .NET 7.0 in the dropdown, and keep the other defaults.
- Name the project RazorPagesMovie.
The template creates a starter project.
- Run the application with Debug > Start Without Debugging.
- If you see a dialog box for invalid certificate, select Run to install the ASP.NET Core debug certificate.
The following table lists the files and folders associated in the project.
Name | Description |
---|---|
wwwroot/ | Contains all the static files. For example CSS, images, and so on. |
Pages/ | Contains Razor Pages and supporting files. Each Razor page is a pair of files: - A .cshtml file that contains markup with C# code using Razor syntax. - A .cshtml.cs PageModel class file that defines page handler methods and data used to render the page. |
RazorPagesMovie.csproj | Contains configuration metadata for the project, such as dependencies. |
Program.cs | Serves as the app's managed entry point and configures app behavior, such as routing between pages. |
NEXT TUTORIAL: Adding a Model