Posted on 2006-04-26
Last Modified: 2013-11-19
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


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 ''.  

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

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

Question by:deighton
    LVL 4

    Expert Comment

    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,
    LVL 18

    Author Comment

    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
    LVL 37

    Assisted Solution

    dtryon is right...because you copied the modules into your'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...
    LVL 4

    Accepted Solution

    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:  Which I'll admit is a bit of a mess, but effective.


    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Shoutout to Emily Plummer ( for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
    What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
    Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
    Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now