--- lang: ja-jp breaks: true --- # ## 空のプロジェクトからの変更  ## Startup.cs ```csharp= public class Startup { public void ConfigureServices(IServiceCollection services) { services.AddRazorPages(); } public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapRazorPages(); }); } } ``` ## Pages/_ViewStart.cshtml ```htmlembedded= @{ Layout = "_Layout"; } ``` ## Pages/Shared/_Layout.cshtml ```htmlembedded= <!DOCTYPE html> <html lang="ja"> <head> <meta charset="utf-8" /> </head> <body> @RenderBody() </body> </html> ``` ## Pages/Index.cshtml ```htmlembedded= @page @model WebApplication18.Pages.IndexModel @{ } <div> <h1>Welcome</h1> </div> ``` ```csharp= using Microsoft.AspNetCore.Mvc.RazorPages; namespace WebApplication18.Pages { public class IndexModel : PageModel { public void OnGet() { } } } ``` :::info デフォルトで、`Pages/Index.cshtml` があればその内容が出力される。 ::: ## 実行 
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up