Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get razor intellisense in library project?

I have a business project where I will be creating emails based on templates made with razor. How can I get razor intellisense there? Is it as simple as including a few assemblies or do I need to do something more retorted?

This is for using the RazorEngine library.

like image 694
bevacqua Avatar asked Apr 28 '12 23:04

bevacqua


1 Answers

You have to edit your .csproj file. Add following ProjectTypeGuids node (add just bellow them bellow existing ProjectGuid node).

<ProjectGuid>{28AD1627-3486-48C2-A045-EFFBB441582B}</ProjectGuid>
<ProjectTypeGuids>{E3E379DF-F4C6-4180-9B81-6769533ABE47};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>

Save file, then reopen it with Visual Studio. VS2012 then performs some conversion, but at the end everything is OK. Tooling is there.

Depending what you are doing (Razor Generator?) you will need some references (System.Web, System.Web.WebPages, System.Web.Mvc, System.Web.Razor, System.Web.Routing...).

This was tested with VS2012.

In Visual Studio 2013 I had to also replace the following line in the .csproj file because it pointed to a wrong loaction:

<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
like image 185
Nenad Avatar answered Oct 23 '22 08:10

Nenad