Re: Project level "Type not defined" error messsage.

Tech-Archive recommends: Fix windows errors by optimizing your registry

bill_at_sempf.net.nospam
Date: 09/02/04


Date: Wed, 1 Sep 2004 17:35:01 -0700


I did know that, yes. I have always had a problem with that in VB.NET, and
I just decided was the day that I was gonna start scrapping the default root
namespace for ASP.NET apps, anyway. Hey, it solved the problem.

"Greg Burns" wrote:

> good to hear
>
> You are aware that C# and VB differ when it comes to namespaces?
>
> VB has an implied root namespace and C# does not.
>
> So if you wrap every class in namespace ProjectName in VB and keep
> ProjectName as your root namespace your effective namespace will look like:
>
> ProjectName.ProjectName.Agents
>
> I assume you are going to leave the rootnamepsace empty if you are planning
> on manually wrapping every class?
>
> Trying to find a good link that deals with this topic...
>
> Greg
>
>
> "bill@sempf.net.nospam" <billsempfnetnospam@discussions.microsoft.com> wrote
> in message news:6F484EBB-4369-417C-A5AB-1BDCA852899F@microsoft.com...
> > Ok, problem solved, thanks to Greg for his help.
> >
> > As it turns out, something DID happen to my root namespace. Must have
> > occurred when I tried to open the project on another machine.
> >
> > What I ended up doing is putting the Namespace / End Namespace around
> every
> > class, like I do in C#. I like that better anyway, because I can
> > heirarchically structure pages in folders with the same name. Nothing
> worse
> > than About, About1, About2 ...
> >
> > Thanks again!
> >
> > S
> >
> > "bill@sempf.net.nospam" wrote:
> >
> > > > "The Intellisense knows that ProjectName is a class"
> > > > What makes you say that, if when you press a dot you get nothing?
> > >
> > > If I type "Dim dal as " the project shows up, and the intellisense knows
> it
> > > is a class.
> > >
> > > > I would try deleting all the files in you obj\debug folder and bin
> folder
> > > > and recompile.
> > >
> > > Hmm, get this. There IS no obj folder!!! What's up with THAT???
> > >
> > > Deleted bin contents and vsweb cache and no dice.
> > >
> > > Really, really weird.
> > >
> > > Working on a remote server. I do that so I can work from my desktop or
> my
> > > laptop, using Open Project From Web. Do it all the time. Didn't work
> with
> > > THIS project though!
> > >
> > > Thanks for help so far, other thoughts? Where is my obj folder?
> WEIRD!!
> > >
> > > S
> > >
> > > "Greg Burns" wrote:
> > >
> > > >
> > > > I would try deleting all the files in you obj\debug folder and bin
> folder
> > > > and recompile.
> > > >
> > > > Last ditch effort maybe also try deleting the files in:
> > > > C:\Documents and
> Settings\<username>\VSWebCache\<computername>\<projectname>
> > > > folder also.
> > > >
> > > > Is this project something you are developing locally, with a local
> copy of
> > > > IIS running and then post to your hosting server when complete?
> Trying to
> > > > understand your enviroment...
> > > >
> > > > Greg
> > > >
> > > >
> > > > "bill@sempf.net.nospam" <billsempfnetnospam@discussions.microsoft.com>
> wrote
> > > > in message news:0CE36FA3-7D52-474B-B593-35D60DCDEBCD@microsoft.com...
> > > > >
> > > > > No, intellisense still works. The default namespace and the project
> name
> > > > > are still the same. The Intellisense knows that ProjectName is a
> class,
> > > > > but
> > > > > if I press a dot after ProjectName, I get nothing. It is like the
> project
> > > > > forgot its own references! Even the pages, which make a codebehind
> with a
> > > > > seperate class by default, don;t show up in the intellisense!
> > > > >
> > > > > No reporting services project, but I did hear about that bug I
> think.
> > > > >
> > > > > S
> > > > >
> > > > > "Greg Burns" wrote:
> > > > >
> > > > >> Are you saying intellisense has stopped working altogether? Or just
> for
> > > > >> your
> > > > >> project's classes?
> > > > >>
> > > > >> (If not the first then ignore) Out of curiosity, does your solution
> have
> > > > >> a
> > > > >> Reporting Services project in it? I had a web app & aRS project in
> a
> > > > >> solution that intellisense suddenly stopped working. Turned out to
> be
> > > > >> related to an Add-In Manager from PeterBlum.com conflicting with
> RS. (He
> > > > >> has
> > > > >> a patch)
> > > > >>
> > > > >> If it is just one class, do you perhaps have it wrapped in a
> namespace
> > > > >> that
> > > > >> you are not prefixing with?
> > > > >>
> > > > >> Dim agentsDal As New ProjectName.NamespaceName.Agents ?
> > > > >>
> > > > >> Although I wouldn't bother with the ProjectName prefix since that
> is
> > > > >> imported by default.
> > > > >>
> > > > >> Last thought, since did you maybe change your rootnamespace so that
> it is
> > > > >> no
> > > > >> longer same as ProjectName? Right-click
> > > > >> Project->Properites->General->Root
> > > > >> Namespace.
> > > > >>
> > > > >> HTH,
> > > > >> Greg
> > > > >>
> > > > >> "bill@sempf.net.nospam"
> <billsempfnetnospam@discussions.microsoft.com>
> > > > >> wrote
> > > > >> in message
> news:7A6C186F-847E-4E5D-AF9D-2A6747882740@microsoft.com...
> > > > >> >
> > > > >> > There is no data layer DLL, the class files are part of the
> project.
> > > > >> > There
> > > > >> > is just a folder called "Classes" and it has VB files in it.
> > > > >> >
> > > > >> > Though I guess I could move them to a DLL and reference them from
> there
> > > > >> > and
> > > > >> > see if that solves the problem. It might be a workaround.
> > > > >> >
> > > > >> > No, though, it is al though the project lost a reference to
> itself! Is
> > > > >> > that
> > > > >> > possible in VB.NET?
> > > > >> >
> > > > >> > "Greg Burns" wrote:
> > > > >> >
> > > > >> >> Sounds like you need to add a reference to your data layer .dll
> file
> > > > >> >> within
> > > > >> >> your project.
> > > > >> >>
> > > > >> >> Greg
> > > > >> >>
> > > > >> >> "bill@sempf.net.nospam"
> > > > >> >> <bill@sempf.net.nospam@discussions.microsoft.com>
> > > > >> >> wrote in message
> > > > >> >> news:9CB6AFB9-3FE8-4E51-9A4F-22BB1278F505@microsoft.com...
> > > > >> >> >I have a traditional VB.NET ASP.NET application. I have it
> done, and
> > > > >> >> >have
> > > > >> >> > been working with no problems for three weeks. I tried to
> open the
> > > > >> >> > project
> > > > >> >> > (hosted on a remote server) on a different machine from which
> I did
> > > > >> >> > the
> > > > >> >> > development, and now it will not compile. It says that all of
> the
> > > > >> >> > types I
> > > > >> >> > defined for the project itself (class files built into the
> project)
> > > > >> >> > are
> > > > >> >> > "not
> > > > >> >> > defined"
> > > > >> >> >
> > > > >> >> > So for instance, I want to instantiate a part of my data
> layer, and
> > > > >> >> > I
> > > > >> >> > have
> > > > >> >> > the line of code
> > > > >> >> >
> > > > >> >> > Dim agentsDal As New ProjectName.Agents
> > > > >> >> >
> > > > >> >> > And it says "Type ProjectName.Agents not Defined". Lo and
> behold,
> > > > >> >> > if I
> > > > >> >> > try
> > > > >> >> > to write a line of code and type "ProjectName." the
> intellisense
> > > > >> >> > can't
> > > > >> >> > find
> > > > >> >> > anything.
> > > > >> >> >
> > > > >> >> > I have more experience with C# webs frankly, so I am thrown
> for a
> > > > >> >> > loop.
> > > > >> >> > I
> > > > >> >> > deleted and recreated the propject file, no dice. I went back
> to
> > > > >> >> > the
> > > > >> >> > old
> > > > >> >> > machine, no dice. I did notice that the binary for the
> project is
> > > > >> >> > missing
> > > > >> >> > (!) but that's what a compile is for, right?
> > > > >> >> >
> > > > >> >> > I have tried several searches online, and just get too much
> data
> > > > >> >> > back -
> > > > >> >> > "Type is not dfined" is a pretty common error message.
> Anyway, and
> > > > >> >> > help
> > > > >> >> > is
> > > > >> >> > much appreciated.
> > > > >> >> >
> > > > >> >> > S
> > > > >> >>
> > > > >> >>
> > > > >> >>
> > > > >>
> > > > >>
> > > > >>
> > > >
> > > >
> > > >
>
>
>



Relevant Pages

  • Re: Project level "Type not defined" error messsage.
    ... Ok, problem solved, thanks to Greg for his help. ... something DID happen to my root namespace. ... >> I would try deleting all the files in you obj\debug folder and bin folder ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Project level "Type not defined" error messsage.
    ... So if you wrap every class in namespace ProjectName in VB and keep ... ProjectName as your root namespace your effective namespace will look like: ... There IS no obj folder!!! ... Where is my obj folder? ...
    (microsoft.public.dotnet.languages.vb)
  • Re: [Assembly].GetExecutingAssembly().GetName().Name Missing Under
    ... >the name of my resource file, just the actual project and executable itself. ... Right, it's the default namespace that matters, not the assembly name. ... Change the root namespace to contain periods instead of underscores ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Cannot "imports" a newspace, Why?
    ... you should change your imports to ... my suggestion is you delete the root namespace from the ... I will see this error message: ...
    (microsoft.public.pocketpc.developer)
  • Re: Default namespace
    ... requiring *any* namespace designations at all is a new one on me. ... just as if that was the Root Namespace. ... > In VB, if you specify a root namespace for the project, it is the root ... The .NET Framework specifies that assemblies have a "Root ...
    (microsoft.public.dotnet.framework)