statiqdev / Statiq.Web

Statiq Web is a flexible static site generator written in .NET.

Home Page:https://statiq.dev/web

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Statiq.Web.props to Statiq.Web.targets causing compilation issues

jsaunders92 opened this issue · comments

Hi,

I have some classes in a folder which I use across a whole website. Finally got around to upgrading from 1.0.0-beta.48 and it's now causing compilation issues such as:

[ERRO] Content/PostProcess » RenderContentPostProcessTemplates » ExecuteIf » ExecuteIf » RenderRazor » services/website-translation.cshtml(238,13): error CS0246: The type or namespace name 'Faq' could not be found (are you missing a using directive or an assembly reference?)

I'm sure it's to do with the move from .props to .targets. Nothing I'm using is in any of the reserved folder names. Is there something I should be doing differently now?

It might indeed have something to do with the new .targets file - as it turns out, the .props file was never actually being applied as intended, so switching to .targets lights up functionality that was always supposed to be working.

Where is the type Faq defined in your project? Does it happen to be in a folder named extensions (see #994)? And what does the Razor code at and around the error in services/website-translation.cshtml look like?

It does not, I did have a look at that issue though. So my folder structure is designed to vaguely be like Razor Pages/MVC.

I have a class at:

/ > Shared > Models > _faq.cs

Then I have a partial view:

/ > Shared > Services > _faq.cshtml

and then in about 8 cshtml pages I have:

@Html.Partial("/shared/services/_faq.cshtml", faq)

@{
        List<Faq> faq = new List<Faq>() {
            new Faq() { Question = "Question 1", Answer = "Answer 1." }
    }
}

I am sure there is probably a million better ways of doing this, but when I originally designed this I just wanted to take the nice stuff from Razor and have them statically compile.