Namespace

In some sample QAS code I'm looking at, there is a class called ProWeb, which is wrapped in a namespace

Namespace com.qas.proweb.soap

.
.
.
.
.

End Namespace

then other modules have an

Imports com.qas.proweb.soap


and that all works ok.



I've copied some of these modules to another project (including the 'Namespace com.qas.proweb.soap' one) and in my new project I can no longer do a 'Imports com.qas.proweb.soap', I need to give my new project name

Imports QASwebAndy.com.qas.proweb.soap



When I look in the object browser for the first project there's a namespace called 'com.qas.proweb.soap' and when I look in the object browser for the second project it's called 'QASwebAndy.com.qas.proweb.soap'.  

How do I avoid the include having to be called 'Imports QASwebAndy.com.qas.proweb.soap' and just use 'Imports com.qas.proweb.soap'  ???


I'm at a loss as to what is different between the two projects setup

LVL 18
deightonprogAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dtryonCommented:
Hi,
I'm not sure about this but I could comment.  As you know, namespaces are simply addresses for finding some code kept inside them.  It looks to me that this com.qas.proweb.soap namespace is a web service.  Since the proxy of the web service is compiled in your dll (not an indepentent dll), I'd guess that .NET doesn't like it standing on its own.  The code that utilizes the web service needs to know where to find the service proxy.

So you may be stuck with it this way.

The only other thing I could mention is the assembly manifest.  As you are aware, all dlls have a meta data file (or manifest) that describes their contents.  There might be something in the manifest about which namespaces are contained in the dll.  Perhaps you need to register it there.

Good luck,
Davin
0
deightonprogAuthor Commented:
I think I've found it it's

'Project->Properties->General' then 'RootNamespace', which is normally equal to the project name, but they have set it to "" in their project
0
samtran0331Commented:
dtryon is right...because you copied the modules into your application...it's namespace is under your application...
instead of copying the modules...have you tried compiling the ProWeb application, then take the compiled dll and copy it into your second project's bin folder...then add a reference to it...
that would be how .NET likes it to "stand on its own"....

same thing but a different approach would be to have both projects into the same solution.
then, don't copy modules from one to the other, reference them...
0
dtryonCommented:
Yes, when you say copied modules, do you mean that you referenced dlls or that you copied the files from a different project? If it is the latter, then you could go into each class of the copied files and manually change the namespace, in order to match the namespace of your project.

As samtran0331 pointed out, what is wrong with adding a reference to the 3rd part dll?  If I were working on a project, I would prefer to keep 3rd party services separate from my dll.  This is because 3rd parties have a nasty habit of updating their code, and down the line it is easier to make the update if you have natural separations in your code logic.  Keeping 3rd party code separate is a good idea.

So like samtran0331, I would suggest compiling the 3rd party code into a dll, and then referencing that dll in your project.  Then your using statement would look like:  ProWebServices.com.qas.proweb.soap.  Which I'll admit is a bit of a mess, but effective.

-Davin
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.