Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Latest commit

 

History

History
45 lines (27 loc) · 2.44 KB

Create-a-Razorpage-VSMac.md

File metadata and controls

45 lines (27 loc) · 2.44 KB

Create a Razor Pages web app in Visual Studio for Mac

The following tutorial is based on "Get started with Razor Pages in ASP.NET Core" from docs.microsoft.com.

Prerequisites

Create a Razor web app

  • 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 project RazorPagesMovie.

  • 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.

Project files and folders explained

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