views:

39

answers:

2

How can i register a namespace in app.config so that it will become globally accessible.

+1  A: 

No, you can't.

Application configuration file does not have any role during compile time. And that is exactly when namespaces are resolved.

I'm afraid there is no way to make a certain namespace accessible "globally" - i.e. without mentioning it in every file.

Fyodor Soikin
@Fyodor: Is it possible in machine config or any such file as it is possible in web.config, so I hope there would be some way for this also.
Shantanu Gupta
No, there is no way. ASP.NET code is compiled during runtime, therefore Web.config can (and does) contain some settings that affect compilation. When you're compiling in Visual Studio or by csc.exe, however, configuration files do not play any role.
Fyodor Soikin
@Fyodor: I am amazed to see that. Its a very bad feature I think.
Shantanu Gupta
A: 

FWIW VB.NET has this feature! (On references tab of a vb project)

MikeG