So I understand that namespaces defined in ~/Views/web.config will add those namespaces for all views. But why is there also a namespace section in ~/web.config in the root folder`?
-
possible duplicate of What does the web.config file do in the views folder of a MVC projectfreshbm– freshbm2013-07-25 12:19:08 +00:00Commented Jul 25, 2013 at 12:19
Add a comment
|
1 Answer
Every view will inherit the namespaces in ~/web.config. Potentially you could build different namespace hierarchies using different levels of config files.
4 Comments
iappwebdev
So I can remove namespaces from
~/web.config if they are also in ~/Views/web.config?juhan_h
Yes. Altough there are cenarios where you would want them to be in the root config file (for instance if you would need to change them with configuration transformations). My experiences with adding and removing namespaces in config files have shown that adding a namespace will take some time to be "recognized" by VS.
iappwebdev
1. What do you mean with
for instance if you would need to change them with configuration transformations? And 2. it is enough to do a clean build and reopen the chtml file.juhan_h
I can imagine a situation where you would want to run one set of helpers in development for debugging the helpers side by side with you MVC app and another one in production where helepers could be shared between multiple apps and located in GAC. Configuration transformations could help you accomplish that. As of #2 in theory it should be enought, but Intellisense cache (where the helpers are living to provide you with development time support) has been somewhat mysterious to me :)