Creating a System folder on a website kills ASP.NET

  • Thread starter Thread starter Tom Welch
  • Start date Start date
T

Tom Welch

You can really mess up ASP.NET easily.

1. Create a new ASP.NET project.
2. Create a new folder on the web named System

Now all objects in the System namespace are invalid because the compiler
starts looking in <projectname>.System for them. You cannot compile or use
any designers. WTF ?!?
 
This is due to namespace collision. When you create a folder in ASP.NET, it
will prepend that folder name on the namespace. So, if you have MyApp and
then create a System folder, it will automatically create a MyApp.System
namespace, which will be used for all contained forms. Since any item in a
namespace can reference any other item in the same namespace, you have now
shadowed the root System namespace from the framework, which (as you can
see) breaks a lot of things, since namespaces such as
System.Web.UI.Webcontrols are rather valuable for ASP.NET development. The
solution is to not use a System folder and, hence, a custom System namespace
in your application. See MSKB 316734 for details.
 
Back
Top