Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 872
  • Last Modified:


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

  • 2
2 Solutions
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,
deightonAuthor 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
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...
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.


Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now