* Use minimal hosting model * Make CoreRuntime backward compatible to the old hosting model * Remove unneccessary methods from interface again * Pushed the timeout for E2E test to 120 minutes instead of 60 * Updated the preview version from 6 to 7 * Explicitly call BootUmbracoAsync * Add CreateUmbracoBuilder extension method * Do not add IRuntime as hosted service when using WebApplication/WebApplicationBuilder * Set StaticServiceProvider.Instance before booting * Ensure Umbraco is booted and StaticServiceProvider.Instance is set before configuring middleware * Do not enable static web assets on production environments * Removed root namespace from viewImports --------- Co-authored-by: Andreas Zerbst <andr317c@live.dk> Co-authored-by: Ronald Barendse <ronald@barend.se>
37 lines
1.3 KiB
C#
37 lines
1.3 KiB
C#
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.Extensions.Hosting;
|
|
using Umbraco.Cms.Core.Configuration.Models;
|
|
using Umbraco.Cms.Core.DependencyInjection;
|
|
|
|
namespace Umbraco.Extensions;
|
|
|
|
/// <summary>
|
|
/// Extension methods for <see cref="WebApplicationBuilder" />.
|
|
/// </summary>
|
|
public static class WebApplicationBuilderExtensions
|
|
{
|
|
/// <summary>
|
|
/// Creates an <see cref="IUmbracoBuilder" /> and registers basic Umbraco services.
|
|
/// </summary>
|
|
/// <param name="builder">The builder.</param>
|
|
/// <returns>
|
|
/// The Umbraco builder.
|
|
/// </returns>
|
|
public static IUmbracoBuilder CreateUmbracoBuilder(this WebApplicationBuilder builder)
|
|
{
|
|
// Configure Umbraco defaults, but ignore decorated host builder and
|
|
// don't add runtime as hosted service (this is replaced by the explicit BootUmbracoAsync)
|
|
builder.Host.ConfigureUmbracoDefaults(false);
|
|
|
|
// Do not enable static web assets on production environments,
|
|
// because the files are already copied to the publish output folder.
|
|
if (builder.Configuration.GetRuntimeMode() != RuntimeMode.Production)
|
|
{
|
|
builder.WebHost.UseStaticWebAssets();
|
|
}
|
|
|
|
return builder.Services.AddUmbraco(builder.Environment, builder.Configuration);
|
|
}
|
|
}
|