Cannot reference a property without removing the Namespace or adding Global in front

53 views Asked by At

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

1

There are 1 answers

0
JPScerri On

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.