Intellisense Errors in VS2022 #186
-
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You're in luck! For background, the problem is that the Visual Studio Razor engine builds Razor pages in the background and makes a bunch of assumptions about what sort of base class is being used for the Razor pages, what namespaces are available, etc. This works for like 99% of the typical Razor uses via ASP.NET. Obviously Statiq isn't ASP.NET, and on top of that, Statiq does some customization of that Razor process that the built-in Visual Studio design-time Razor engine has no idea about (such as changing the Razor view base class). Thankfully there actually is a way to tell the Visual Studio Razor Intellisense engine about the correct namespace imports and base Razor class that Statiq uses. The instructions are here: https://www.statiq.dev/guide/content-and-data/template-languages/razor#imports-file-and-intellisense. The important bit is:
@using Statiq.Common
@using Statiq.Razor
@using Statiq.Web
@using Statiq.Web.Pipelines
@using Microsoft.Extensions.Logging
@inherits StatiqRazorPage<IDocument> That should get you going, let me know if you have any trouble after this. Note that you may need to tweak the |
Beta Was this translation helpful? Give feedback.
You're in luck! For background, the problem is that the Visual Studio Razor engine builds Razor pages in the background and makes a bunch of assumptions about what sort of base class is being used for the Razor pages, what namespaces are available, etc. This works for like 99% of the typical Razor uses via ASP.NET. Obviously Statiq isn't ASP.NET, and on top of that, Statiq does some customization of that Razor process that the built-in Visual Studio design-time Razor engine has no idea about (such as changing the Razor view base class).
Thankfully there actually is a way to tell the Visual Studio Razor Intellisense engine about the correct namespace imports and base Razor class that Stati…