.net Class "is not a member of" Class .. even though it is?

Posted by Matt Thrower on Stack Overflow See other posts from Stack Overflow or by Matt Thrower
Published on 2010-05-11T11:42:20Z Indexed on 2010/05/11 12:24 UTC
Read the original article Hit count: 350

Filed under:
|

Hi,

Looking over some older code, I've run into a strange namespace error.

Let's say I have two projects, HelperProject and WebProject. The full namespace of each - as given in application properties - is myEmployer.HelperProject and myEmployer.Web.WebProject.

The pages in the web project are full of statements that use classes from the helper project. There are no imports/using statements but there is a reference to the helper project added in the bin. A few example lines might be:

myEmployer.HelperProject.StringHelper.GetFixedLengthText(Text, "", Me.Width, 11)
myEmploter.HelperProject.Utils.StringHelper.EstimatePixelLength(Text, 11)

However every line that is written in this manner is throwing the error 'HelperProject' is not a member of 'myEmployer'. If you declare the statements like this:

HelperProject.StringHelper.GetFixedLengthText(Text, "", Me.Width, 11)
HelperProject.Utils.StringHelper.EstimatePixelLength(Text, 11)

Everything seems fine.

In the solution object browser and the bin folder, HelperProject appears with its full namespace, myEmployer.HelperProject.

I don't want to have to change all the statements, and besides I suspect this is masking a more fundamental problem here. But I have no idea what's going on. Can anyone offer any pointers please?

Cheers, Matt

© Stack Overflow or respective owner

Related posts about .NET

Related posts about namespaces