rickbutterfield/Umbraco.Community.BlockPreview

Build error after installing

Closed this issue · 5 comments

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

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

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

@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

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

namespace YourProject
{
    using Umbraco.Community.BlockPreview;

I have updated the README to make this more clear