Namespace Management

D

Don Wash

Hi There!

I just need some advice on Namespace management for creating reusable VB.NET
applications.

I would like my applications to have this namespace structure...

Namespace MyCompany

Namespace MyApplication1

Namespace Module1

End Namespace

End Namespace

End Namespace

However, I find it hard to enforce this structure throughout many different
VB.NET files and projects. For example, I need to manually type in Namespace
for MyCompany, MyApplication1 and Module(n) for every VB.NET class files.

Is there anyway to define a namespace on the Root directory and all the
VB.NET files in the child directory automatically inherits the parent
Namespace?

Thanks in advance!

Don
 
K

Ken Tucker [MVP]

Hi,

In the projects properties you can set the root namespace.


Ken
----------------
Hi There!

I just need some advice on Namespace management for creating reusable VB.NET
applications.

I would like my applications to have this namespace structure...

Namespace MyCompany

Namespace MyApplication1

Namespace Module1

End Namespace

End Namespace

End Namespace

However, I find it hard to enforce this structure throughout many different
VB.NET files and projects. For example, I need to manually type in Namespace
for MyCompany, MyApplication1 and Module(n) for every VB.NET class files.

Is there anyway to define a namespace on the Root directory and all the
VB.NET files in the child directory automatically inherits the parent
Namespace?

Thanks in advance!

Don
 
D

Don Wash

Hi Ken,

Thanks for the reply. I can now set it. However, as I presented the
Namespace structure in my previous post, my Namespace structure looks like
following...

Namespace MyCompany

Namespace MyApplication1

Namespace Module1

End Namespace

End Namespace

End Namespace

So as you can see, there will be no projects whatsoever using 'MyCompany'
namespace. It will just be a wrapper Namespace which will wrap the actual
applications such as 'MyApplication1' and children. So do I need to create a
dummy project just to create a wrapper Namespace 'MyCompany' ?

Thanks again,
Don
 
D

Don Wash

Yes, I could. But then again, I have to set this information to every
application I develop which is very redundant and really a pain when I need
to change company name.

Any other methods?

Thanks,
Don
 
S

Scott M.

I do a lot of work with a Global insurance company that has a standard that
all applications will start with the company name followed by other company
specific information.

Developers are simply told that when they create a new project, set the root
namespace to Companyname.otherInfo.etc. It isn't really a big deal because
they are not making new projects every 2 seconds and it only takes 2 seconds
to set the root namespace.
 
A

Andy Becker

Don Wash said:
Yes, I could. But then again, I have to set this information to every
application I develop which is very redundant and really a pain when I need
to change company name.

Any other methods?

Thanks,
Don

That's pretty much the limit of your choices, I'm afraid. Nothing that
can't be handled with a good program editor's file search/replace
functionality - on those rare occasions when the company name changes. :)

Best Regards,

Andy
 

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

Top