Upgrade Umbraco on macOS

I am building a site with VS Code on macOS. I currently have version 16 and want to go to 16.2.0-rc, but I can’t figure out how to upgrade the package reference.

Can anyone help me out with this? All of the dotnet upgrade references I search for are for Windows

The command line should work for any platform, including macOS:

You can do:

dotnet add package Umbraco.Cms --version 16.2.0-rc

After that a dotnet run should work but you might want to do these 3 commands instead:

dotnet restore
dotnet build
dotnet run

Restore and build succeed. Run does not

Unhandled exception. System.Reflection.ReflectionTypeLoadException: Could not load all types from "Umbraco.Cms.StaticAssets, Version=16.2.0.0, Culture=neutral, PublicKeyToken=null" due to LoaderExceptions, skipping:
. System.IO.FileNotFoundException: Could not load file or assembly 'Umbraco.Web.Website, Version=16.2.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.


Could not load file or assembly 'Umbraco.Web.Website, Version=16.2.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

   at Umbraco.Cms.Core.Composing.TypeFinder.GetTypesWithFormattedException(Assembly a)
   at Umbraco.Cms.Core.Composing.TypeFinder.GetClassesWithBaseType(Type baseType, IEnumerable`1 assemblies, Boolean onlyConcreteClasses, Func`2 additionalFilter)
   at Umbraco.Cms.Core.Composing.TypeFinder.FindClassesOfType(Type assignTypeFrom, IEnumerable`1 assemblies, Boolean onlyConcreteClasses)
   at Umbraco.Extensions.TypeFinderExtensions.FindClassesOfType[T](ITypeFinder typeFinder, IEnumerable`1 assemblies, Boolean onlyConcreteClasses)
   at Umbraco.Cms.Core.Composing.TypeLoader.<>c__DisplayClass13_0`1.<GetTypes>b__1()
   at Umbraco.Cms.Core.Composing.TypeLoader.GetTypesInternalLocked(Type baseType, Type attributeType, Func`1 finder, String action, Boolean cache)
   at Umbraco.Cms.Core.Composing.TypeLoader.GetTypesInternal(Type baseType, Type attributeType, Func`1 finder, String action, Boolean cache)
   at Umbraco.Cms.Core.Composing.TypeLoader.GetTypes[T](Boolean cache, IEnumerable`1 specificAssemblies)
   at Umbraco.Cms.Core.DependencyInjection.UmbracoBuilderExtensions.AddAllCoreCollectionBuilders(IUmbracoBuilder builder)
   at Umbraco.Cms.Core.DependencyInjection.UmbracoBuilder.AddCoreServices()
   at Umbraco.Cms.Core.DependencyInjection.UmbracoBuilder..ctor(IServiceCollection services, IConfiguration config, TypeLoader typeLoader, ILoggerFactory loggerFactory, IProfiler profiler, AppCaches appCaches)
   at Umbraco.Extensions.UmbracoBuilderExtensions.AddUmbraco(IServiceCollection services, IWebHostEnvironment webHostEnvironment, IConfiguration config)
   at Umbraco.Extensions.WebApplicationBuilderExtensions.CreateUmbracoBuilder(WebApplicationBuilder builder)
   at Program.<Main>$(String[] args) in /Users/{user}/Software/{Project}/{Project}.Web/Program.cs:line 3
   at Program.<Main>(String[] args)
System.IO.FileNotFoundException: Could not load file or assembly 'Umbraco.Web.Website, Version=16.2.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

File name: 'Umbraco.Web.Website, Version=16.2.0.0, Culture=neutral, PublicKeyToken=null'

You probably also need to update other packages. If you look in your .csproj file, anything starting with Umbraco.Cms should be updated to 16.2.0-rc. You can edit the file or do that on the command line.

Alternatively, you can also see which nuget packages are outdated using:

dotnet list package --outdated

In your case, since you want to move to a release candidate, you’d need to change it to

dotnet list package --outdated --include-prerelease

Warning: this will show you other “outdated” packages that are not Umbraco, I wouldn’t recommend upgrading those to pre-release versions.

The issue was with the extension, which I updated the versions to 16.2.0-rc and ran the restore and build commands.

<ItemGroup>
    <PackageReference Include="Umbraco.Cms.Web.Website" Version="*" />
    <PackageReference Include="Umbraco.Cms.Web.Common" Version="*" />
    <PackageReference Include="Umbraco.Cms.Api.Common" Version="*" />
    <PackageReference Include="Umbraco.Cms.Api.Management" Version="*" />
  </ItemGroup>

Thanks!

1 Like

We just had a chat about this in the team.

For anyone reading this later: To upgrade to an RC version of the UmbracoExtension template, you must specify the version manually, or else the NuGet restore fails.

dotnet new umbraco-extension --name TestExtension --version 16.2.0-rc -ex

That is because the default “version” value is ”*”, which only works for non-prerelease versions of Umbraco, i.e., “16.2.0”, which is not out yet.

My tiptap editor looked a little weird so I though I would install a new project to see if it looked ok and I am getting an error on npm install

in terminal

mkdir MyProject
cd MyProject
dotnet new umbraco -n MyProject.Web --version 16.2.0-rc
cd MyProject.Web
dotnet run
(install Umbraco) 

here I get an in-browser error after installation on redirect to the login page

error:invalid_request
error_description:The specified 'client_id' is invalid.
error_uri:https://documentation.openiddict.com/errors/ID2052

I can navigate to localhost/umbraco and log in.

in terminal

cd ..
dotnet new umbraco-extension -n MyProject.Ext --version 16.2.0-rc
cd MyProject.Web
dotnet add reference ../MyProject.Ext/MyProject.Ext.csproj
cd ../MyProject.Ext/Client
npm install

which leads to

npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: [email protected]
npm error Found: @hey-api/[email protected]
npm error node_modules/@hey-api/client-fetch
npm error   dev @hey-api/client-fetch@"^0.10.2" from the root project
npm error
npm error Could not resolve dependency:
npm error peer @hey-api/client-fetch@"^0.12.0" from @umbraco-cms/[email protected]
npm error node_modules/@umbraco-cms/backoffice
npm error   dev @umbraco-cms/backoffice@"^16.2.0-rc" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.

You have stumbled into another bug, for which there is a fix slated for 16.3.0. It is apparently more widespread than I realised, so I’ll see if we can do something about it a bit sooner. It is registered here:

There is a temp solution, which is to manually pin the version of @hey-api/openapi-ts because the template is using an older version than the CMS.

Run this command in your client project:

npm install --save @hey-api/[email protected]
npm install

That should pin the version to 0.12.0, which the Backoffice uses, and you should be good to go.

That worked. It gave me a deprecated warning, which I am sure you are aware of.

npm warn deprecated @hey-api/[email protected]: Starting with v0.73.0, this package is bundled directly inside @hey-api/openapi-ts.
npm warn deprecated [email protected]: Use your platform's native DOMException instead
1 Like

Yep, but thanks for noticing anyway! That is being addressed in 16.3.0, where we are using the newest openapi-ts with the built-in client.