The following tutorial is based on "Get started with ASP.NET Core Razor Pages in Visual Studio Code" from docs.microsoft.com.
Enter the following commands in the terminal:
dotnet new razor -o RazorPagesMovie -f net7.0
cd RazorPagesMovie
dotnet run
Open a browser and browse to https://localhost:{PORT}/ to view the application. The {PORT} will be visible in the output in terminal.
- Shut down your application using
Ctrl+C
. - Open your project in VS Code using one of the following options:
- Select File > Open Folder, and then select the
RazorPagesMovie
folder. - Enter the following command in the terminal
code .
- Select File > Open Folder, and then select the
- If you get the prompt Do you trust the authors of the files in this folder, select Yes, I trust the authors.
- If you get the prompt Required assets to build and debug are missing from 'RazorPagesMovie'. Add them?", select Yes.
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