Josef Henryson
03/06/2024, 8:41 AMkdx-perbol
03/06/2024, 8:54 AMSebastiaan
03/06/2024, 9:58 AMcsharp
using Microsoft.AspNetCore.Builder;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Extensions;
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
builder.CreateUmbracoBuilder()
    .AddBackOffice()
    .AddWebsite()
    .AddDeliveryApi()
    .AddComposers()
    .Build();
WebApplication app = builder.Build();
await app.BootUmbracoAsync();
app.UseUmbraco()
    .WithMiddleware(u =>
    {
        u.UseBackOffice();
        u.UseWebsite();
    })
    .WithEndpoints(u =>
    {
        u.UseBackOfficeEndpoints();
        u.UseWebsiteEndpoints();
    });
await app.RunAsync();
And your .csproj file:
xml
<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <IsPackable>true</IsPackable>    
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Umbraco.Cms" Version="13.3.0" />
  </ItemGroup>
  <ItemGroup>
    <!-- Opt-in to app-local ICU to ensure consistent globalization APIs across different platforms -->
    <PackageReference Include="Microsoft.ICU.ICU4C.Runtime" Version="72.1.0.3" />
    <RuntimeHostConfigurationOption Include="System.Globalization.AppLocalIcu" Value="72.1.0.1" Condition="$(RuntimeIdentifier.StartsWith('linux')) or $(RuntimeIdentifier.StartsWith('win')) or ('$(RuntimeIdentifier)' == '' and !$([MSBuild]::IsOSPlatform('osx')))" />
  </ItemGroup>
  <PropertyGroup>
    <!-- Razor files are needed for the backoffice to work correctly -->
    <CopyRazorGenerateFilesToPublishDirectory>true</CopyRazorGenerateFilesToPublishDirectory>
  </PropertyGroup>
  <PropertyGroup>
    <!-- Remove RazorCompileOnBuild and RazorCompileOnPublish when not using ModelsMode InMemoryAuto -->
    <RazorCompileOnBuild>false</RazorCompileOnBuild>
    <RazorCompileOnPublish>false</RazorCompileOnPublish>
  </PropertyGroup>
</Project>
No Startup.csSebastiaan
03/06/2024, 9:59 AMSebastiaan
03/06/2024, 9:59 AMJosef Henryson
03/06/2024, 12:22 PMkdx-perbol
03/06/2024, 12:23 PMJosef Henryson
03/06/2024, 12:24 PMJosef Henryson
03/06/2024, 12:26 PMJosef Henryson
03/06/2024, 12:26 PMJosef Henryson
03/06/2024, 12:32 PMSebastiaan
03/06/2024, 12:34 PMJosef Henryson
03/06/2024, 12:34 PMSebastiaan
03/06/2024, 12:35 PMJosef Henryson
03/06/2024, 12:35 PMSebastiaan
03/06/2024, 12:35 PMJosef Henryson
03/06/2024, 1:08 PMJosef Henryson
03/06/2024, 1:22 PMSebastiaan
03/07/2024, 10:51 AMOsman CoΕkun
03/08/2024, 10:26 AMA hub and casual space for you to interact with fellow community members and learn more about Umbraco!
Powered by