0

I got a solution with several projects and was working fine. One fine day, hundreds of errors cropped out, apparently from nowhere!

After hours trying to find out why, I noticed that any Property within a project with Namespace 'IBS_DAL' cannot be referenced as IBS_DAL.PropertyName. It can either be referenced as Global.IBS_DAL.PropertyName or just PropertyName. The error states:

Type IBS_DAL.PropertyName is not defined.

Can anyone please tell me what could I have changed in my solution.

Sample Code:

Imports System.Xml
Imports System.Data.Linq.Mapping
Imports System.Data.SqlClient
Imports J2.J2Errors
Imports System.Text
Imports System.IO
Imports System.Threading

Imports System.Transactions
Imports System.Windows.Forms
Imports System.Drawing

Public Class ImportRawData

    Dim P1 As Global.IBS_DAL.Stock = Nothing
    Dim P2 As IBS_DAL.Stock = Nothing
...

enter image description here

In project IBS DAL, P1 works fine, but P2 does not. Outside project IBS DAL, both work fine.

Thanks JP

JPScerri
  • 115
  • 1
  • 1
  • 8
  • 1
    Chances are, the word "static " has been removed from the IBS_DAL class declaration. – CDove Jan 24 '17 at 17:58
  • Can you show the definition of `PropertyName` and from where it's being referenced? – David Jan 24 '17 at 18:01
  • I'm using VB Is there a central place where where I could have switched it off? Cos this is spread all over the project! – JPScerri Jan 24 '17 at 18:05
  • David, ANY property/field is showing this problem! – JPScerri Jan 24 '17 at 18:07
  • Add the code for the IBS_DAL module, at least the module/namespace definition and the property definition. – Gusman Jan 24 '17 at 18:09
  • Gusman, sample code added above. – JPScerri Jan 24 '17 at 18:21
  • vb project has namespaces import in properties... Well. Try to clean solution, close it, remove .suo file and open it again. – T.S. Jan 24 '17 at 18:59
  • Tried that T.S., but still errors remained. – JPScerri Jan 25 '17 at 07:10
  • In the properties of your project, what is the "Root Namespace" set to? And do you have any `Namespace` statements? Where is `IBS_DAL` defined? If it's in another project, is that project referenced? – Chris Dunaway Jan 25 '17 at 21:35
  • Root Namespace is IBS_DAL. I'm not sure is there are any other Namespace statements in other Projects, but shouldn't. IBS_DAL is defined only in the IBS_DAL project. From other projects, I can easily reference the IBS_DAL properties. Only from within the IBS_DAL Project I cannot reference the properties using the Namespace. Without the Namespace or Using the Global in front, it works fine. – JPScerri Jan 26 '17 at 07:29

1 Answers1

0

Found the bug.

Found an Auto Generated code in file IBS_DAL.Designer. Since it generated a class named IBS_DAL, this conflicted with the Namespace IBS_DAL.

Do not know how his code was generated. Just remarked the contents and excluded the file from the project.

JPScerri
  • 115
  • 1
  • 1
  • 8