How to set a top-level namespace when you've defined a root namespace? | | |
Hi,
I suspect that this isn't possible, but I figured I'd ask.
My project has a root namespace, let's say it's "Root", that applies to
almost every source file (which is why I've set it as the project's root
namespace).
However, the project also includes a couple of source files whose contents
will live in an entirely different namespace, let's say the "Special"
namespace.
So, within those particular source files, I use the Namespace statement:
Namespace Special
However, this puts the code into the namespace "Root.Special", not
"Special".
Does anyone know whether it's possible to use the Namespace statement to put
something into a top level namespace, NOT within the project's root
namespace?
Thanks,
Jeff Brown | | | | re: How to set a top-level namespace when you've defined a root namespace?
Jeff,[color=blue]
> Does anyone know whether it's possible to use the Namespace statement to
> put something into a top level namespace, NOT within the project's root
> namespace?[/color]
No, when you set the project's root namespace it is set for every file!
Have you considered moving the Special namespace into its own project? As it
sounds like it is outside the namespace of the current project.
However most of my solutions, the root of all projects share a common root.
For example, in my "My Application" solution, I might have:
Solution: My Application
Folder: My Application
Project: My App
Folder: My Application\My App
Namespace: MyApp
Assembly: MyApp.exe
Project: Framework
Folder: My Application\Framework
Namespace: MyApp.Framework
Assembly: MyApp.Framework.dll
Project: Plugin1
Folder: My Application\Plugin1
Namespace: MyApp.Plugin1
Assembly: MyApp.Plugin1.dll
Project: Plugin2
Folder: My Application\Plugin2
Namespace: MyApp.Plugin2
Assembly: MyApp.Plugin2.dll
Project: Data
Folder: My Application\Data
Namespace: MyApp.Data
Assembly: MyApp.Data.dll
Project: UI
Folder: My Application\UI
Namespace: MyApp.UI
Assembly: MyApp.UI.dll
Hope this helps
Jay
"Jeff Brown" <worldsofinsanity@hotmail.com> wrote in message
news:%23CqcB4XoEHA.1152@TK2MSFTNGP11.phx.gbl...[color=blue]
> Hi,
>
> I suspect that this isn't possible, but I figured I'd ask.
>
> My project has a root namespace, let's say it's "Root", that applies to
> almost every source file (which is why I've set it as the project's root
> namespace).
>
> However, the project also includes a couple of source files whose contents
> will live in an entirely different namespace, let's say the "Special"
> namespace.
>
> So, within those particular source files, I use the Namespace statement:
> Namespace Special
>
> However, this puts the code into the namespace "Root.Special", not
> "Special".
>
> Does anyone know whether it's possible to use the Namespace statement to
> put something into a top level namespace, NOT within the project's root
> namespace?
>
> Thanks,
> Jeff Brown
>
>
>[/color] | | | | re: How to set a top-level namespace when you've defined a root namespace?
Jeff,[color=blue]
> Does anyone know whether it's possible to use the Namespace statement to
> put something into a top level namespace, NOT within the project's root
> namespace?[/color]
No, when you set the project's root namespace it is set for every file!
Have you considered moving the Special namespace into its own project? As it
sounds like it is outside the namespace of the current project.
However most of my solutions, the root of all projects share a common root.
For example, in my "My Application" solution, I might have:
Solution: My Application
Folder: My Application
Project: My App
Folder: My Application\My App
Namespace: MyApp
Assembly: MyApp.exe
Project: Framework
Folder: My Application\Framework
Namespace: MyApp.Framework
Assembly: MyApp.Framework.dll
Project: Plugin1
Folder: My Application\Plugin1
Namespace: MyApp.Plugin1
Assembly: MyApp.Plugin1.dll
Project: Plugin2
Folder: My Application\Plugin2
Namespace: MyApp.Plugin2
Assembly: MyApp.Plugin2.dll
Project: Data
Folder: My Application\Data
Namespace: MyApp.Data
Assembly: MyApp.Data.dll
Project: UI
Folder: My Application\UI
Namespace: MyApp.UI
Assembly: MyApp.UI.dll
Hope this helps
Jay
"Jeff Brown" <worldsofinsanity@hotmail.com> wrote in message
news:%23CqcB4XoEHA.1152@TK2MSFTNGP11.phx.gbl...[color=blue]
> Hi,
>
> I suspect that this isn't possible, but I figured I'd ask.
>
> My project has a root namespace, let's say it's "Root", that applies to
> almost every source file (which is why I've set it as the project's root
> namespace).
>
> However, the project also includes a couple of source files whose contents
> will live in an entirely different namespace, let's say the "Special"
> namespace.
>
> So, within those particular source files, I use the Namespace statement:
> Namespace Special
>
> However, this puts the code into the namespace "Root.Special", not
> "Special".
>
> Does anyone know whether it's possible to use the Namespace statement to
> put something into a top level namespace, NOT within the project's root
> namespace?
>
> Thanks,
> Jeff Brown
>
>
>[/color] |  | Similar Visual Basic .NET bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,382 network members.
|