在web.config中删除的命名空间未在具有母版的页面中删除 [英] Namespace removed in web.config not removed in a page with master

查看:104
本文介绍了在web.config中删除的命名空间未在具有母版的页面中删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在子目录的web.config中定义了此

I have defined this in the web.config of a subdirectory

<namespaces>
   <remove namespace="App"/>
   <add namespace="Tom"/>
</namespaces>

App被导入到父web.config文件中,Tom和App的类具有相同的名称.

App is imported in the parent web.config file, Tom and App have classes with the same names.

为避免类名歧义而导致的错误,我从使用Tom命名空间的子目录中删除了App命名空间.

To avoid errors resulting from ambiguous class names I removed the App namespace from the sub-directory where the Tom namespace is used.

但是,仍将名称空间App导入到具有Tom目录之外的母版页的内容页面上.这会导致上述错误.

However the namespace App is still imported on content pages that have a master page outside the Tom directory. This causes the aforementioned errors.

这是我的目录结构

-Root Directory 
--Default.master
--web.config (App is added in web.config)
--Tom Sub-diretory
---web.config (App is removed in web.config)
---Content page that uses Default.master (Here is the problem)
---Page without master (Works OK)

有解决方案吗?

推荐答案

用命名空间显式为用法添加前缀是什么?那应该一直有效.

What about explicitly prefix the usages with the namespace? That should always work.

这篇关于在web.config中删除的命名空间未在具有母版的页面中删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆