Wednesday, March 28, 2012
Strange compilation errors
d
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?
Thanksyou 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" <Argirop@.discussions.microsoft.com> wrote in message
news:8B674FC6-4D83-4D02-8076-1EA6D72E804E@.microsoft.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
>
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 nam
e,
> 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 assemb
ly
> your ok. if they end up in different assemblies, then you're in trouble.
> -- bruce (sqlwork.com)
> "Argirop" <Argirop@.discussions.microsoft.com> wrote in message
> news:8B674FC6-4D83-4D02-8076-1EA6D72E804E@.microsoft.com...
>
>
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:
>
Strange compilation errors
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?
Thanksyou 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" <Argirop@.discussions.microsoft.comwrote in message
news:8B674FC6-4D83-4D02-8076-1EA6D72E804E@.microsoft.com...
Quote:
Originally Posted by
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
>
>
And how can I add a reference to Default1 in Default2 ?
"bruce barker (sqlwork.com)" wrote:
Quote:
Originally Posted by
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" <Argirop@.discussions.microsoft.comwrote in message
news:8B674FC6-4D83-4D02-8076-1EA6D72E804E@.microsoft.com...
Quote:
Originally Posted by
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
>
>
>
Never mind, I found it.
Thanks a lot.
"Argirop" wrote:
Quote:
Originally Posted by
And how can I add a reference to Default1 in Default2 ?
>
"bruce barker (sqlwork.com)" wrote:
>
Quote:
Originally Posted by
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" <Argirop@.discussions.microsoft.comwrote in message
news:8B674FC6-4D83-4D02-8076-1EA6D72E804E@.microsoft.com...
Quote:
Originally Posted by
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
>
>
Monday, March 26, 2012
Strange error
Server Error in '/GescomDllo' Application.
Compilation Error
Description:An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.Compiler Error Message:CS0006: Metadata file 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\gescomdllo\27bee1ac\cdebe31b\App_global.asax.29cg_tf4.dll' could not be found
Source Error:
|
Source File: Line: 0
Show Detailed Compiler Output:
|
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
?xmlversion="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings/>
<connectionStrings>
<addname="MySqlConnection"connectionString="Data Source=localhost;Initial Catalog=GEscomDllo;Integrated Security=SSPI;" />
</connectionStrings>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<trustlevel="Medium"/>
<compilationdebug="true"/>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<siteMapdefaultProvider="SiteMapSecuritySample"enabled="true">
<providers>
<addname="QuickStartSiteMapSecuritySample"
description="Proveedor de seguridad para la jerarquia de navegacion del sitio con roles."
type="System.Web.XmlSiteMapProvider"
securityTrimmingEnabled="true"
siteMapFile="web.sitemap"/>
</providers>
</siteMap>
<httpCookieshttpOnlyCookies="true"requireSSL="false"domain=""/>
<authenticationmode="Forms">
<formsloginUrl="Login.aspx"protection="All"timeout="30"name="AppNameCookie"path="/Protected/"requireSSL="false"slidingExpiration="true"cookieless="UseCookies"enableCrossAppRedirects="false"/>
</authentication>
<authorization>
<allowusers="*"/>
</authorization>
<roleManagerenabled="true"defaultProvider="SqlRoleManager"cacheRolesInCookie="true"cookieTimeout="30"cookieRequireSSL="false"createPersistentCookie="true">
<providers>
<addname="SqlRoleManager"type="System.Web.Security.SqlRoleProvider"connectionStringName="MySqlConnection"applicationName="Gescom"/>
</providers>
</roleManager>
<membershipdefaultProvider="SqlProvider"userIsOnlineTimeWindow="15">
<providers>
<clear/>
<addname="SqlProvider"type="System.Web.Security.SqlMembershipProvider"connectionStringName="MySqlConnection"applicationName="Gescom"enablePasswordRetrieval="false"enablePasswordReset="false"requiresQuestionAndAnswer="false"requiresUniqueEmail="true"passwordStrengthRegularExpression="^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,10}$"passwordFormat="Hashed"/>
</providers>
</membership>
<!--
<customErrors mode="On" defaultRedirect="ErrDefault.aspx">
<error statusCode="401" redirect="ErrNoAutorizado.aspx"/>
<error statusCode="404" redirect="ErrPaginaNoEncontrada.aspx"/>
<error statusCode="500" redirect="ErrServidor.htm"/>
</customErrors>-->
</system.web>
<locationpath="public">
<system.web>
<authorization>
<allowusers="*"/>
</authorization>
</system.web>
</location>
<locationpath="Protected/Administradores">
<system.web>
<authorization>
<allowroles="Administradores"/>
<denyusers="?"/>
</authorization>
</system.web>
</location>
<locationpath="Protected/ConsultorParcial">
<system.web>
<authorization>
<allowroles="ConsultorParcial"/>
<denyusers="?"/>
</authorization>
</system.web>
</location>
<locationpath="Protected/ConsultorTotal">
<system.web>
<authorization>
<allowroles="ConsultorTotal"/>
<denyusers="?"/>
</authorization>
</system.web>
</location>
<locationpath="Protected/Evaluadores">
<system.web>
<authorization>
<allowroles="Evaluadores"/>
<denyusers="?"/>
</authorization>
</system.web>
</location>
<locationpath="Protected/Planeadores">
<system.web>
<authorization>
<allowroles="Planeadores"/>
<denyusers="?"/>
</authorization>
</system.web>
</location>
<locationpath="Protected/Retroalimentadores">
<system.web>
<authorization>
<allowroles="Retroalimentadores"/>
<denyusers="?"/>
</authorization>
</system.web>
</location>
<!-- other configuration settings here-->
</configuration>
Try deleting that folder:-C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\gescomdlloMore strange yet, I am administrator on my machine and I hadnt access to delete it. I closed vs 2005 and nothing, I will try rebooting.
Go into services on the machine. Stop the IIS Admin Service. Click ok to let it stop the other services. Now delete the folder and restart the services, IIS Admin, Ftp, Smtp and Web publishing. Alot to do for something that might not work but worth a try.
Thanks that worked, but why happened this to me? That should not be a normal behavior.