{"id":2764,"date":"2011-01-20T13:44:00","date_gmt":"2011-01-20T13:44:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/webdev\/2011\/01\/20\/how-to-get-razor-intellisense-for-model-in-a-class-library-project\/"},"modified":"2011-01-20T13:44:00","modified_gmt":"2011-01-20T13:44:00","slug":"how-to-get-razor-intellisense-for-model-in-a-class-library-project","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/how-to-get-razor-intellisense-for-model-in-a-class-library-project\/","title":{"rendered":"How to get Razor intellisense for @model in a class library project"},"content":{"rendered":"<p>Many of us follow a modular architecture and create MVC3 Razor view in a separate class library project.<\/p>\n<p>Following<span>&nbsp; <\/span>is a screenshot of the class library project that I have created.<\/p>\n<p><img decoding=\"async\" height=\"337\" width=\"204\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2011\/01\/5417.classlibrary.png\" border=\"0\" \/><\/p>\n<p>Now if I open a view with @model typed in it, I notice<span>&nbsp; <\/span>that it shows squiggle for @model and no intellisense is shown. (error: There is build provider registered for the extension &#8216;.cshtml&#8217;)<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2011\/01\/3580.model_squiggle.png\" border=\"0\" \/><\/p>\n<p>The reason behind the error is that Visual Studio 2010 (for Razor tooling) requires web.config file (with some specific settings)<span>&nbsp; <\/span>to be in the project so that the MVC Razor host (which adds the @model directive) gets registered correctly.&nbsp;<\/p>\n<p><span lang=\"en-AU\">The <\/span><span lang=\"en-US\">workaround would be<span>&nbsp; <\/span>to drop the attached <a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Components.PostAttachments\/00\/10\/11\/83\/78\/web.txt\">web.config<\/a> (rename the attached file&nbsp;from web.txt to web.config) &nbsp;to the root of the project. Close,<span>&nbsp; <\/span>reopen the file and Boom, intellisense is back for @model inside the class library project.<\/span><\/p>\n<p style=\"margin: 0in;font-family: Calibri;font-size: 11pt\">&nbsp;<img decoding=\"async\" height=\"50\" width=\"443\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2011\/01\/2018.modelintellisense.png\" border=\"0\" \/><\/p>\n<p style=\"margin: 0in;font-family: Calibri;font-size: 11pt\">&nbsp;<\/p>\n<p lang=\"en-AU\" style=\"margin: 0in;font-family: Calibri;font-size: 11pt\">&nbsp;<\/p>\n<p lang=\"en-AU\" style=\"margin: 0in;font-family: Calibri;font-size: 11pt\">Hope this helps,<\/p>\n<p lang=\"en-AU\" style=\"margin: 0in;font-family: Calibri;font-size: 11pt\">Deepak<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Components.PostAttachments\/00\/10\/11\/83\/78\/web.txt\">web.txt<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Many of us follow a modular architecture and create MVC3 Razor view in a separate class library project. Following&nbsp; is a screenshot of the class library project that I have created. Now if I open a view with @model typed in it, I notice&nbsp; that it shows squiggle for @model and no intellisense is shown. [&hellip;]<\/p>\n","protected":false},"author":404,"featured_media":58792,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[197],"tags":[7347,7383,7384,7323,7324,7363],"class_list":["post-2764","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-aspnet","tag-asp-net-4","tag-deepak-verma","tag-razor","tag-visual-studio-2010","tag-vs10","tag-vs2010"],"acf":[],"blog_post_summary":"<p>Many of us follow a modular architecture and create MVC3 Razor view in a separate class library project. Following&nbsp; is a screenshot of the class library project that I have created. Now if I open a view with @model typed in it, I notice&nbsp; that it shows squiggle for @model and no intellisense is shown. [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/2764","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/404"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=2764"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/2764\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/58792"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=2764"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=2764"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=2764"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}