Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Console App CSHTML Intellisense and Binding?

I have a console app without a project reference to any ASP.NET MVC App. Running Visual Studio 2010.

I created a cshtml file to test some template binding. I am not getting IntelliSense in the cshtml and putting "@model MyDataClass" at the beginning of the page is not getting recognized either.

How can get some View functionality in my console app?

Thanks.

like image 496
Snowy Avatar asked Feb 27 '12 19:02

Snowy


2 Answers

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

Also, add references to System.Web.Razor.dll and System.Web.WebPages.Razor.dll

like image 60
Konstantin Avatar answered Oct 03 '22 07:10

Konstantin


Try using RazorEngine it allows you to use Razor templating in Console applications.

like image 44
jaredmahan Avatar answered Oct 03 '22 08:10

jaredmahan