adoconnection / RazorEngineCore

.NET6 Razor Template Engine
MIT License
565 stars 84 forks source link

Layout does not exists in the current context #95

Closed CeSiumUA closed 2 years ago

CeSiumUA commented 2 years ago

Hi!) I'm trying to compule some view, which containes, but getting always errors: Unable to compile template: sg3sjobq.yfd(13,5): error CS0103: The name 'Layout' does not exist in the current context sg3sjobq.yfd(14,5): error CS0103: The name 'ViewBag' does not exist in the current context sg3sjobq.yfd(15,5): error CS0103: The name 'ViewBag' does not exist in the current context sg3sjobq.yfd(16,5): error CS0103: The name 'ViewBag' does not exist in the current context sg3sjobq.yfd(18,5): error CS0103: The name 'ViewBag' does not exist in the current context sg3sjobq.yfd(22,5): error CS0103: The name 'ViewBag' does not exist in the current context sg3sjobq.yfd(23,5): error CS0103: The name 'ViewBag' does not exist in the current context sg3sjobq.yfd(26,7): error CS0103: The name 'section' does not exist in the current context Could someone help me please, how to fix it?

adoconnection commented 2 years ago

https://github.com/adoconnection/RazorEngineCore/wiki/@Include-and-@Layout

adoconnection commented 2 years ago

this engine is not the same MVC you used to. So you cant just use your exising views, they need to be modified a little bit