Question Compiler error with Namespace referencing...

Terry

Member
Joined
Aug 19, 2014
Messages
13
Programming Experience
3-5
I have the following compiler error:

Namespace or type specified in the Imports 'myNameSpace' doesn't contain any public member or cannot be found.....

There would appear to be three possible causes according to Microsoft, but I am pretty sure(ahem!) that at least two of them don't apply to my case.

The three possible causes are:

1. A containing element is not accessible.
2. The specification of an element doesnt include an Alias....
3. The containing element exposes at least one member...

I am ruling out (?) 2 and 3 because I am not using Aliases, and because the referenced assembly does include a Public Function contained within a Public Class. Therefore, I assume the root cause must be in the referencing, however, despite trying many different things I have been unable to solve the problem.

In terms of referencing, I have ensured that the Imports statement refers to the root namespace of the assembly and I have added a reference to the assembly in my main programme. As far as I understand (?) if this is done it should be possible for the main programme now to access the assembly, but is there something else I am missing? I have spent many hours trying to seek a solution without success. Alternatively can someone point me to some code snippets where I can take a simple exe application and a referenced assembly with Imports and use this as a template.

Many thanks
 
You can check by right-click (context menu) in Solution Explorer on the reference and select "View in Object Browser". Here you can expand the assembly and review the namespaces available (and what types they contain, and their members). Namespaces with no public types will not be listed. You may have to click "Show All Files" in Solution Explorer to show References tree.

It is also possible to import the namespace globally, in project properties References tab there is a box "Imported namespaces", if you can find the namespaces of the referenced assembly here you can simply check them to have them imported for whole project. Some standard namespaces have been checked here already for .Net libraries, but all available namespaces is listed.
 
Many thanks for taking the time to reply John. The reminder of the feature to "View in Object Browser" was very welcomed and definitely saves time in figuring what members are available to what Namespaces rather than having to open those assemblies etc. Howeevr, it didnt actually move me closer to solving the problem. On the other hand I made some changes to my approach which seems to have temporarily solved the problem but honestly I am not sure why. Since I am not sure exactly what worked and what didn't the problem could arise again.

What I am working with is a large project where one exe calls several DLLs which in turn reference other DLLs in order to work. I am not sure if I am developing my application in the right way but here's what I am doing. I hyave developed the application orginillay as one project which now consists of around 500 procedures. I understand that I will eventually need to "break-out" many of those as individual DLLs to allow the main exe to operate in an agile manner which will ultimately make better use of resources. However, I am delaying that because then I will need to maintain configuration control of 500 DLLs which, although being necessary will be a nightmare. While I transition to that point I am trying to understand how to use the vb compiler to compile a user generated input file and link it to the executable and other DLLs to produce an output solution. I still havent completely figured out how to correctly do the individual compiling/linking and referencing without getting errors like I described earlier. Can you reccommend a good reference to really understand how a large project with multiple assemblies and references should be structured?

Any help that you can give me is most appreciated.

Many thanks
 
Can you reccommend a good reference to really understand how a large project with multiple assemblies and references should be structured?
No, I can't.
 
Back
Top