Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jsaunders92 opened this issue Jan 5, 2023 · 2 comments
Open

Comments

@jsaunders92
Copy link

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?

@daveaglick
Copy link
Member

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?

@jsaunders92
Copy link
Author

jsaunders92 commented Jan 6, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants