ASP.NET 3.5 网站默认停止导入系统命名空间
我有一个 VB 网站项目,最近(并且神秘地)默认停止导入“System”命名空间。
我必须在后面每个代码的顶部放置一个 Imports System
行,或者在所有内容前面加上 System
,这相当烦人,更不用说冗余了。我一生都无法弄清楚如何让 System
命名空间恢复为默认导入状态。
我已经检查过 WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\web.config
包含
我在
节点中的 System
命名空间中引用了多个命名空间(例如 System.Design
、System.Web我的网站的 web.config 的扩展
没有
节点。
我最近没有改变。有人有什么建议吗?
I have a VB Web Site project that has recently (and mysteriously) stopped importing the "System" namespace by default.
I'm having to either place an Imports System
line at the top of each code behind, or preface everything with System
, which is fairly annoying, not to mention redundant. I can't for the life of me figure out how to get the System
namespace back to being imported by default.
I've already checked to see that WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\web.config
contains the <add namespace="System"/>
line--it does. That was my best lead.
I have references to several namespaces within the System
namespace in the <assemblies>
node (e.g. System.Design
, System.Web.Extensions
of my website's web.config. There is no <namespaces>
node. This has not been changed recently.
I'm tearing my hair out. Does anyone have any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这似乎像它最初破裂一样神秘地自行修复了。我不确定我做了什么,但它现在正在发挥作用。就这样。
This seems to have fixed itself as mysteriously as it broke in the first place. I'm not sure what I did, but it's working now. So it goes.
刚刚在 VS 2013 中的 VB Web 项目中经历过这个。
很多情况下,系统、System.Collections1 中的类型会出现错误,...
结果是在复制
时出现的。
元素到web.config
中(作为添加一些更好的日志记录的一部分),我也复制了周围的
元素。随之而来的是很多奇怪的事情。当我发现我可以运行站点并且 IIS 错误页面告诉我有一个配置错误时,我就发现了问题。
现在重做我在寻找这一点的过程中撤消的所有更改......
1 遗留代码维护的奇迹。
Just been through this with a VB Web Project in VS 2013.
Lots of cases of the error from types in the System, System.Collections1, …
Turns out when copying a
<configSections>
element into theweb.config
(as part of adding some better logging) I'd copied the surrounding<configuration>
element in as well.Lots of weirdness followed. Was able to find issue when I found I could get the site to run and the IIS error page told me I had a configuration error.
Now to redo all the changes I had undone on my way to finding that….
1 The wonders of legacy code maintenance.