473,325 Members | 2,442 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Strange compilation errors

Assuming two aspx pages named Defaul1 and Default2 whith separate code behind
files. The corresponding class names are Defaul1 and Default2 respectively
and are in the same namespace (MyCompany.MyApplication.UI).

In the "Page_Load" of Page2 class I have the following code

if ( Context.Handler is Page1 )
Page1 sourcePage = (Page1)Context.Handler;

Not allways but quite often during the build, I see the following error:

The type or namespace name 'Page1' could not be found (are you missing a
using directive or an assembly reference?)

The error message appears twise indicating the two code lines above.

There is no missing "using" because both classes are in the same namespace.
There is no missing assemply reference because both classes (pages) are in
the same web project.

The dev environment is VS 2005 and in the code behind files the classes are
declared as partial.

Any ideas what could be the problem?

Thanks
Sep 27 '06 #1
3 1395
you should not confuse namespaces with assemblies. namespace is just that, a
naming prefix. using a namespace just allows shortcuts in speciing names.
several assemblies (dlls) may use the same namespace, or one assembly may
have several namespaces. to reference a routine, you must specify the name,
but also must include the assembly containing the routine.

asp.net builds an assembly per page, so even though you use the same
namespace, you als need to add a reference to the page. a confusing facter
is that asp.net will compile serveral pages into the same dll if batching is
allowed. if you forgt the refernce and the pages end up in the same assembly
your ok. if they end up in different assemblies, then you're in trouble.

-- bruce (sqlwork.com)

"Argirop" <Ar*****@discussions.microsoft.comwrote in message
news:8B**********************************@microsof t.com...
Assuming two aspx pages named Defaul1 and Default2 whith separate code
behind
files. The corresponding class names are Defaul1 and Default2 respectively
and are in the same namespace (MyCompany.MyApplication.UI).

In the "Page_Load" of Page2 class I have the following code

if ( Context.Handler is Page1 )
Page1 sourcePage = (Page1)Context.Handler;

Not allways but quite often during the build, I see the following error:

The type or namespace name 'Page1' could not be found (are you missing a
using directive or an assembly reference?)

The error message appears twise indicating the two code lines above.

There is no missing "using" because both classes are in the same
namespace.
There is no missing assemply reference because both classes (pages) are in
the same web project.

The dev environment is VS 2005 and in the code behind files the classes
are
declared as partial.

Any ideas what could be the problem?

Thanks


Sep 27 '06 #2
And how can I add a reference to Default1 in Default2 ?

"bruce barker (sqlwork.com)" wrote:
you should not confuse namespaces with assemblies. namespace is just that, a
naming prefix. using a namespace just allows shortcuts in speciing names.
several assemblies (dlls) may use the same namespace, or one assembly may
have several namespaces. to reference a routine, you must specify the name,
but also must include the assembly containing the routine.

asp.net builds an assembly per page, so even though you use the same
namespace, you als need to add a reference to the page. a confusing facter
is that asp.net will compile serveral pages into the same dll if batching is
allowed. if you forgt the refernce and the pages end up in the same assembly
your ok. if they end up in different assemblies, then you're in trouble.

-- bruce (sqlwork.com)

"Argirop" <Ar*****@discussions.microsoft.comwrote in message
news:8B**********************************@microsof t.com...
Assuming two aspx pages named Defaul1 and Default2 whith separate code
behind
files. The corresponding class names are Defaul1 and Default2 respectively
and are in the same namespace (MyCompany.MyApplication.UI).

In the "Page_Load" of Page2 class I have the following code

if ( Context.Handler is Page1 )
Page1 sourcePage = (Page1)Context.Handler;

Not allways but quite often during the build, I see the following error:

The type or namespace name 'Page1' could not be found (are you missing a
using directive or an assembly reference?)

The error message appears twise indicating the two code lines above.

There is no missing "using" because both classes are in the same
namespace.
There is no missing assemply reference because both classes (pages) are in
the same web project.

The dev environment is VS 2005 and in the code behind files the classes
are
declared as partial.

Any ideas what could be the problem?

Thanks


Sep 27 '06 #3
Never mind, I found it.

Thanks a lot.

"Argirop" wrote:
And how can I add a reference to Default1 in Default2 ?

"bruce barker (sqlwork.com)" wrote:
you should not confuse namespaces with assemblies. namespace is just that, a
naming prefix. using a namespace just allows shortcuts in speciing names.
several assemblies (dlls) may use the same namespace, or one assembly may
have several namespaces. to reference a routine, you must specify the name,
but also must include the assembly containing the routine.

asp.net builds an assembly per page, so even though you use the same
namespace, you als need to add a reference to the page. a confusing facter
is that asp.net will compile serveral pages into the same dll if batching is
allowed. if you forgt the refernce and the pages end up in the same assembly
your ok. if they end up in different assemblies, then you're in trouble.

-- bruce (sqlwork.com)

"Argirop" <Ar*****@discussions.microsoft.comwrote in message
news:8B**********************************@microsof t.com...
Assuming two aspx pages named Defaul1 and Default2 whith separate code
behind
files. The corresponding class names are Defaul1 and Default2 respectively
and are in the same namespace (MyCompany.MyApplication.UI).
>
In the "Page_Load" of Page2 class I have the following code
>
if ( Context.Handler is Page1 )
Page1 sourcePage = (Page1)Context.Handler;
>
Not allways but quite often during the build, I see the following error:
>
The type or namespace name 'Page1' could not be found (are you missing a
using directive or an assembly reference?)
>
The error message appears twise indicating the two code lines above.
>
There is no missing "using" because both classes are in the same
namespace.
There is no missing assemply reference because both classes (pages) are in
the same web project.
>
The dev environment is VS 2005 and in the code behind files the classes
are
declared as partial.
>
Any ideas what could be the problem?
>
Thanks
>
>
Sep 27 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: P G | last post by:
I hope this is on topic here. I have a problem compiling a simple example of the use of boost::bind. Please take a look at the program below. ...
2
by: FireStarter | last post by:
Guys, in the code that follows, why does the method F() still compile, even if DBG is undefined? Inside method G(), the code inside <#if DBG> does not compile (notice that I can write whatever I...
2
by: Tommy Vercetti | last post by:
In Visual Studio .NET 2003, I do the following 1) File->New->Project 2) Visual C++ Projects->.NET->Windows Forms Application 3) Project->Add New Item->C++ File 4) Clear the new C++ file and...
1
by: Jiho Han | last post by:
I have an asp.net application that is running and I updated code behind assemblies after I modified some internal logic. Then I tried to view the page and got a very strange error, something like...
1
by: Jill Graham | last post by:
Hi, From time to time, I receive following error message when trying to access my website. When the error occurs, I have to recompile my dll until the error disappears (this without changing...
1
by: Ricky K. Rasmussen | last post by:
Hi NG, When connecting to a local WebService one of our customers gets a very strange exception: "File or assembly name gaw9eaqv.dll, or one of its dependencies, was not found." The...
35
by: mwelsh1118 | last post by:
Why doesn't C# allow incremental compilation like Java? Specifically, in Java I can compile single .java files in isolation. The resulting individual .class files can be grouped into .jar files....
2
by: f0zzyNUE | last post by:
hi everyone, currently we are testing the performance our application (asp.net based CMS) ... for that reason we wrote a "spider" that starts webrequests for all relevant pages which results in...
2
by: =?Utf-8?B?UGF1bCBCdXp6YSwgb2xkc3RlciB1c2luZyBuZXcg | last post by:
I recently implemented error processing on my .net website, where I send myself an email from global.asax on an application error. In the last two days I have gotten a "The file '/detail.aspx'...
1
by: BSand0764 | last post by:
I'm getting an error that I can't seem to resolve. When I compile the Functor related logic in a test program, the files compile and execute properly (see Listing #1). However, when I...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.