How can I make intellisense work in Razor for classes where the namespace is imported in web.config?
I've added the following to the Web.config in my ~/Views folder:
<add namespace="DTuppeny.Blog.Models" />
开发者_StackOverflow社区
This means at the top of my view, I can now type:
@model Post
instead of
@model DTuppeny.Blog.Models.Post
This all compiles and works fine, however when I type "@Model." I don't get any intellisense.
Is this a bug, or have I done something wrong?
I just tried what you describe in a project of mine, and as long as I kept the .cshtml file open, the intellisense indeed didn't work.
It did work though after I closed and re-opened the file (I also recompiled in between... not sure if that is necessary). Did you do that?
Also: Do you have the latest tools update installed?
Also, make sure you modify the top level web.config, there is another web.config in the views folder
精彩评论