CSHTML Intellisense Console Application and Binding?

I have a console application without a project reference for any ASP.NET MVC application. Starting Visual Studio 2010.

I created a cshtml file to check for template binding. I do not get IntelliSense in cshtml and putting "@model MyDataClass" at the top of the page is also not recognized.

How to get some View functions in my console application?

Thanks.

+4
source share
2 answers

Follow the instructions on this blog - https://blogs.msdn.microsoft.com/webdev/2011/01/20/how-to-get-razor-intellisense-for-model-in-a-class-library-project/

Also add links to System.Web.Razor.dll and System.Web.WebPages.Razor.dll

+3
source

Try using RazorEngine , which allows you to use Razor templates in console applications.

+1
source

Source: https://habr.com/ru/post/1398672/


All Articles