Namespace Compile Issue

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Brian

    #1

    Namespace Compile Issue

    I am having a problem with namespace resolution. Example is below:

    Namespace MyNamespace
    Public Class MyClass
    public x as System.String
    end class
    end namespace

    I get the following compile error:
    Type 'System.String' is not defined.

    Using VS 2003. There is a reference to system.dll in the project. Nothing
    else unusual that I know of. Why won't it resolve System.String?
    If I make it just String it works, but I am using some generated code so
    this is not easy to change everywhere.

    Please help!!!
    Thanks, Brian.
  • Cowboy (Gregory A. Beamer) - MVP

    #2
    RE: Namespace Compile Issue

    The main issue I see, from the code sample, is MyClass, which is an illegal
    class name. Are you command line compiling?

    ---

    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA

    *************** ************
    Think Outside the Box!
    *************** ************



    "Brian" wrote:
    [color=blue]
    > I am having a problem with namespace resolution. Example is below:
    >
    > Namespace MyNamespace
    > Public Class MyClass
    > public x as System.String
    > end class
    > end namespace
    >
    > I get the following compile error:
    > Type 'System.String' is not defined.
    >
    > Using VS 2003. There is a reference to system.dll in the project. Nothing
    > else unusual that I know of. Why won't it resolve System.String?
    > If I make it just String it works, but I am using some generated code so
    > this is not easy to change everywhere.
    >
    > Please help!!!
    > Thanks, Brian.[/color]

    Comment

    • Brian

      #3
      RE: Namespace Compile Issue

      Thanks for the reply......I got the mystery solved.
      One of the generated classes in the namespace was named System. Obviously
      this caused havoc resolving any type that was System.*

      It hit me on the way home tonight!

      Brian

      "Cowboy (Gregory A. Beamer) - MVP" wrote:
      [color=blue]
      > The main issue I see, from the code sample, is MyClass, which is an illegal
      > class name. Are you command line compiling?
      >
      > ---
      >
      > Gregory A. Beamer
      > MVP; MCP: +I, SE, SD, DBA
      >
      > *************** ************
      > Think Outside the Box!
      > *************** ************
      >
      >
      >
      > "Brian" wrote:
      >[color=green]
      > > I am having a problem with namespace resolution. Example is below:
      > >
      > > Namespace MyNamespace
      > > Public Class MyClass
      > > public x as System.String
      > > end class
      > > end namespace
      > >
      > > I get the following compile error:
      > > Type 'System.String' is not defined.
      > >
      > > Using VS 2003. There is a reference to system.dll in the project. Nothing
      > > else unusual that I know of. Why won't it resolve System.String?
      > > If I make it just String it works, but I am using some generated code so
      > > this is not easy to change everywhere.
      > >
      > > Please help!!!
      > > Thanks, Brian.[/color][/color]

      Comment

      Working...