Skip to content

Instantly share code, notes, and snippets.

@talkingdotnet
Created October 20, 2017 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save talkingdotnet/85d56618975a9c434799571ecf149790 to your computer and use it in GitHub Desktop.
Save talkingdotnet/85d56618975a9c434799571ecf149790 to your computer and use it in GitHub Desktop.
/// <summary>
/// Configures Razor Pages to be rooted at the content root (<see cref="IHostingEnvironment.ContentRootPath"/>).
/// </summary>
/// <param name="builder">The <see cref="IMvcCoreBuilder"/>.</param>
/// <returns>The <see cref="IMvcBuilder"/>.</returns>
public static IMvcBuilder WithRazorPagesAtContentRoot(this IMvcBuilder builder)
{
if (builder == null)
{
throw new ArgumentNullException(nameof(builder));
}
builder.Services.Configure<RazorPagesOptions>(options => options.RootDirectory = "/");
return builder;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment