Logo

dev-resources.site

for different kinds of informations.

Quick fix for IPublishedSnapshotAccessor issues when upgrading to Umbraco 15

Published at
11/29/2024
Categories
umbraco
Author
skttl
Categories
1 categories in total
umbraco
open
Author
5 person written this
skttl
open
Quick fix for IPublishedSnapshotAccessor issues when upgrading to Umbraco 15

If you are using Umbraco ModelsBuilder in one of the SourceCode modes like me, chances are that you'll run into problems when upgrading to Umbraco 15.

Because of the new cache in Umbraco things have changed around how content is fed to the models, and with that, the IPublishedSnapshotAccessor interface has removed.

As all the ModelsBuilder models depend on that, they will fail to build, once you have upgraded the necessary NuGet packages to Umbraco.

I think the official advice is to uncomment all models and code that uses them. As a lazy dev, this is not what I want.

In stead, you can piggy back the interface back into Umbraco.

Simply, add the following snippet to one of your .generated.cs model files, and your project can build again.

namespace Umbraco.Cms.Core.PublishedCache
{
    public interface IPublishedSnapshotAccessor : IPublishedContentTypeCache { }
}
Enter fullscreen mode Exit fullscreen mode

You then have to go into Umbraco, and rebuild your models. This will generate models that are compatible with Umbraco 15, and you are good to go.

If you use IPublishedSnapshotAccessor elsewhere, you would need to refactor that code too though.

umbraco Article's
30 articles in total
Favicon
It doesn’t have to be complicated to build a custom Umbraco property editor
Favicon
please create a post for custom section's tree
Favicon
Umbraco package of the month: xStatic
Favicon
Umbraco and Bellissima: Swagger, Tokens, Entry Points
Favicon
Catching the Bus? How a Service Bus and Azure Functions Can Help Your Integration Reliability
Favicon
Driving Umbraco's dictionary to the edge (of your system)
Favicon
Managing Stale Carts in Umbraco Commerce
Favicon
Quick fix for IPublishedSnapshotAccessor issues when upgrading to Umbraco 15
Favicon
Umbraco package of the month: Auto dictionaries
Favicon
Umbraco package of the month: Uskinned
Favicon
Learning TDD by doing: Tagging members in Umbraco's Rich Text Editor
Favicon
Learning TDD by doing: Dealing with Umbraco's published content
Favicon
My Highlights from the Umbraco US Festival 2024
Favicon
Mastering Authorization in Umbraco 14/15: Real-World Management API Challenges and Solutions
Favicon
Adding Entity Actions to Trees in Umbraco 14
Favicon
Umbraco Forms 12+, Custom Field Type
Favicon
Make your own Umbraco Starter Kit without making a Starter Kit
Favicon
Adding Dynamic Routes to Umbraco 14 Sections
Favicon
Building Custom Trees in Umbraco 14 using menus!
Favicon
Doing custom sections in Umbraco 14
Favicon
Facetted search with Examine - Umbraco 13
Favicon
Server-side registering of Package Manifest in Umbraco 14
Favicon
How to skip login screens during development for Umbraco 13 Users and Members
Favicon
My journey through programmatically creating Umbraco `stuff`
Favicon
Deploying TypeScript Type Definitions for Umbraco v14 Packages
Favicon
Creating an Umbraco Backoffice Accessor for Conditional Page Rendering
Favicon
Create an API in Umbraco in 5 Minutes: A Quick Guide for Developers
Favicon
How to Create a New Umbraco Project: A Step-by-Step Guide
Favicon
Programmatically add a new 'Accepted file extension'
Favicon
Umbraco CodeGarden24

Featured ones: