Creating a System folder on a website kills ASP.NET

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 ?!?
 
C

Chris Jackson

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top