rickbutterfield / Umbraco.Community.BlockPreview

Easy to use rich HTML backoffice previews for the Umbraco Block List and Block Grid editors.
MIT License
15 stars 10 forks source link

Build error after installing #19

Closed claushingebjerg closed 1 year ago

claushingebjerg commented 1 year ago

I'm not sure if this is the right place, but here goes

when i add AddBlockPreview() to the Startup.cs file, before AddWebsite(), as stated in the docs, i get the following error on build.

error CS1061: 'IUmbracoBuilder' does not contain a definition for 'AddBlockPreview' and no accessible extension method 'AddBlockPreview' accepting a first argument of type 'IUmbracoBuilder' could be found (are you missing a using directive or an assembly reference?)

Im running Umbraco 10.5.1. and blockpreview 1.2.1 in VSCode on Mac

rickbutterfield commented 1 year ago

Hi @claushingebjerg! Have you added @using Umbraco.Community.BlockPreview to your other using statements?

claushingebjerg commented 1 year ago

Its a totally vanilla install. Where should i add the using? i added it to _ViewImports.cshtml. Stil getting the error.

rickbutterfield commented 1 year ago

@claushingebjerg You will need to add it to the top of the Startup.cs file. The _ViewImports.cshtml is so you don't have to add loads of @usings to every view

claushingebjerg commented 1 year ago

Ahh ok. So for anyone reading this, your startup.cs should start like this

namespace YourProject
{
    using Umbraco.Community.BlockPreview;
rickbutterfield commented 1 year ago

I have updated the README to make this more clear