You need to install ASP.NET and web development which installs all the necessary components; then you don't necessarily need to select any individual component individually; however you may want to choose different versions of .NET.
For more information see:
Which explains the prerequisites in VS, and VS code, and also shows how to create a Razor Page app.