Upgrade Umbraco
# help-with-umbraco
j
I am trying to upgrade Umbraco 11.5.0 to Umbraco 13.1.1 It seems I get a Stackoverflow exception already in startup. Actually already in Program => Main. It does not reach Startup. Please see images. Anyone had a similar problem after upgrading? Cheers, Josef https://cdn.discordapp.com/attachments/1214855405361037332/1214855405684137984/image.png?ex=65faa143&is=65e82c43&hm=57a4a3ed078c31220547bf1ea494f1fb1b4c1c7fbd80e8e45ca25a64109cd4d9& https://cdn.discordapp.com/attachments/1214855405361037332/1214855406019411968/image.png?ex=65faa143&is=65e82c43&hm=b08179f58d83b88867a3e78ff7b63b2b89bef949b71a02ea30f7b691e94c1eb5&
k
No. But since "ICU" is in there, could it simply be a wrong version of the ICU NuGet package? I think 13 must use the latest one but 12 and lower must not. Otherwise, scaffold a new 13 project and compare csproj/program/startup with your upgraded solution and adjust your upgraded solution to match. I don't think 13 even uses Startup tbqh...
s
I agree. Program.cs should look like this (add your customizations after it runs the first time during the upgrade):
Copy code
csharp
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:
Copy code
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.cs
You can add your packages to the <PackageReference section of course.
I set it to 13.3.0 since that's the latest
j
Huge thanks!! In my simple mind it should just be to upgrade nuget and run πŸ˜„
k
Wait until you upgrade from 8 to 13... πŸ˜‰
j
hehe, will not do that... again (7 => 11 though)
But I just created another U13 site from scratch but borrowed code from a U12 project with Program/Startup and it runs fine... I read about the new approach but since that one worked I supposed this upgraded code should still work as well.
Good to learn new things anyway. So thanks again!
Hmm. My NuGet says 13.1.1 is the latest? How come do I not see 13.3.0? πŸ€”
s
Lol don't mind me, I've gotten way ahead of myself.. too many numbers! You're absolutely right, and 13.2 is coming out tomorrow πŸ‘
j
πŸ˜„ I suspected something like that πŸ™‚
s
You should, but this is an LTS and we shifted a few things around, nothing major but it requires some extra attention. Also remember your project needs to be .net 8 now
j
Yeah that one I sorted out at least πŸ™‚ Thank you so much for quick response!
s
You can indeed keep startup and program, but just make it easier on your future self.. and don't πŸ˜‰
j
Btw. Should services in Startup be moved to composers instead? Or elsewehere?
Sorted it out... builder.Services.* πŸ™‚
s
o
While upgrading a v8 site to 13 i upgraded the database to latest version. Then created an empty 13.1.1 project and hooked the upgraded database.
8 Views