c# - The type 'X' does not exist in the type 'Y.Z' -
our team has migrated visual studio 2008/.net3.5 visual studio 2010/.net4.0. now, vs2010 gives me strange error message. it's reproducible following program:
using system; namespace some.main { } namespace somelib { interface { } } namespace consoleapplication1 { using some.main; using somelib; class program { static void main(string[] args) { console.write("press enter continue"); console.readline(); } } } this worked fine in vs2008, in vs2010 following error message:
the type name 'main' not exist in type 'somelib.some'
interestingly, if hit 'build solution', program builds fine, , can execute without problems. it's visual studio seems have problem code.
unfortunately, i'm working on large-ish legacy application , cannot (easily) change names of these namespaces.
i'd know how can fix error, , i'm curious causes it.
you make editor confused. some both namespace , interface name, evidently doesn't check/parse usings in order they're declared.
if want make clear you're referring namespace , not type name add global:: using declaration (to start root namespace), this:
using global::some.main; update
very post here on linked @alex in comment: should 'using' statements inside or outside namespace?
Comments
Post a Comment