I spent most of two hours trying to figure it out. Here:
I just want to create an HTMLHelper extension method. This has been done many times before, and I know that I code it correctly. However, Razor seems to know about this if I put the code file in App_Code (the folder that I thought no longer makes sense in the MVC world!)
How do I know this?
Quite simply ... I have two identically encoded HTMLHelper extension methods in two separate files with the same name.
The first file, located inside ~ / Extensions, contains the DisplayForProperty extension method
The second file, placed inside ~ / App_Code, contains the DisplayForProperty2 extension method
When in the view I type @Html.Displ - Intellisense shows me DisplayForProperty2 !
I do not have @using instructions, as this does not seem necessary to view DisplayForProperty2 . Not to mention that in this case, nothing will change.
So why is this? Should this be so? Is it just that the Razor is delayed, or am I alone retarded?
I am using a completely updated copy of VS 2012.
PS. On the other hand, do I need to place a link to namespaces in each web.config file under each / directory submission (as well as in each separate Area) plus in the root? Why can't I just put this in the root directory or in the root / Views directory?
source share