Hello,

I am working with VS 2008 and created a Web Application Project.

I added a class but whatever I do the class is not visible to my aspx
pages or anywhere else.

I then changed the property Build Action in my class from Content to
Compile. Now it is recognized.

Why do I need to do this?

Do I need to do this with all classes I create?

Thanks,

Miguel

Re: Use class ... why is not available? by Mark

Mark
Thu May 08 09:13:15 CDT 2008

"shapper" <mdmoura@gmail.com> wrote in message
news:811ff1c6-7f0c-4849-96e4-7d55f109b3f7@a23g2000hsc.googlegroups.com...

> I added a class but whatever I do the class is not visible to my aspx
> pages or anywhere else.
>
> I then changed the property Build Action in my class from Content to
> Compile. Now it is recognized.
>
> Why do I need to do this?

Sounds like something's up with your installation of VS.NET, as classes
(should) have their Build Action property set to Compile by default...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net


Re: Use class ... why is not available? by shapper

shapper
Thu May 08 11:43:15 CDT 2008

On May 8, 3:13 pm, "Mark Rae [MVP]" <m...@markNOSPAMrae.net> wrote:
> "shapper" <mdmo...@gmail.com> wrote in message
>
> news:811ff1c6-7f0c-4849-96e4-7d55f109b3f7@a23g2000hsc.googlegroups.com...
>
> > I added a class but whatever I do the class is not visible to my aspx
> > pages or anywhere else.
>
> > I then changed the property Build Action in my class from Content to
> > Compile. Now it is recognized.
>
> > Why do I need to do this?
>
> Sounds like something's up with your installation of VS.NET, as classes
> (should) have their Build Action property set to Compile by default...
>
> --
> Mark Rae
> ASP.NET MVPhttp://www.markrae.net

Hi,

I think the problem is where the classes are being added to.
App_Folder or somewhere else.

I created a Web Application Project.

When I add a class to App_Folder it VS 2008 makes "Build: Content". If
I add the class somewhere else it says "Build: Compile".

The problem is when I create classes in App_Folder they don't seem to
be accessible to ASPX pages as it is usual in Web Site.

When I changed them "Build: Compile" then I am able to build the
solution with no errors but when I preview an ASPX pages I get errors
everywhere.

The only solution I found was to make all classes "Build: Compile" and
rename the App_Code folder to New_App_Code.

I think I am missing something.

Any idea?

Thanks,

Miguel

Re: Use class ... why is not available? by Juan

Juan
Thu May 08 12:25:28 CDT 2008

re:
!> The problem is when I create classes in App_Folder they don't
!> seem to be accessible to ASPX pages as it is usual in Web Site.

!> The only solution I found was to make all classes "Build: Compile"
!> and rename the App_Code folder to New_App_Code.

Have you tried putting all your classes in the App_Code folder, instead of in your App_Folder folder ?

ASP.NET will not automatically compile classes in application folders,
but *will* compile classes in source files in the App_Code folder.

Better yet, have you considered compiling your helper classes
into assemblies and placing the dll's in your app's bin directory ?





Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"shapper" <mdmoura@gmail.com> wrote in message news:93187d96-3ff0-4157-956f-d6d1bdbc12cc@r66g2000hsg.googlegroups.com...
> On May 8, 3:13 pm, "Mark Rae [MVP]" <m...@markNOSPAMrae.net> wrote:
>> "shapper" <mdmo...@gmail.com> wrote in message
>>
>> news:811ff1c6-7f0c-4849-96e4-7d55f109b3f7@a23g2000hsc.googlegroups.com...
>>
>> > I added a class but whatever I do the class is not visible to my aspx
>> > pages or anywhere else.
>>
>> > I then changed the property Build Action in my class from Content to
>> > Compile. Now it is recognized.
>>
>> > Why do I need to do this?
>>
>> Sounds like something's up with your installation of VS.NET, as classes
>> (should) have their Build Action property set to Compile by default...
>>
>> --
>> Mark Rae
>> ASP.NET MVPhttp://www.markrae.net
>
> Hi,
>
> I think the problem is where the classes are being added to.
> App_Folder or somewhere else.
>
> I created a Web Application Project.
>
> When I add a class to App_Folder it VS 2008 makes "Build: Content". If
> I add the class somewhere else it says "Build: Compile".
>
> The problem is when I create classes in App_Folder they don't seem to
> be accessible to ASPX pages as it is usual in Web Site.
>
> When I changed them "Build: Compile" then I am able to build the
> solution with no errors but when I preview an ASPX pages I get errors
> everywhere.
>
> The only solution I found was to make all classes "Build: Compile" and
> rename the App_Code folder to New_App_Code.
>
> I think I am missing something.
>
> Any idea?
>
> Thanks,
>
> Miguel



Re: Use class ... why is not available? by shapper

shapper
Thu May 08 13:47:08 CDT 2008

On May 8, 6:25 pm, "Juan T. Llibre" <nomailrepl...@nowhere.com> wrote:
> re:
> !> The problem is when I create classes in App_Folder they don't
> !> seem to be accessible to ASPX pages as it is usual in Web Site.
>
> !> The only solution I found was to make all classes "Build: Compile"
> !> and rename the App_Code folder to New_App_Code.
>
> Have you tried putting all your classes in the App_Code folder, instead of=
in your App_Folder folder ?
>
> ASP.NET will not automatically compile classes in application folders,
> but *will* compile classes in source files in the App_Code folder.
>
> Better yet, have you considered compiling your helper classes
> into assemblies and placing the dll's in your app's bin directory ?
>
> Juan T. Llibre, asp.net MVP
> asp.net faq :http://asp.net.do/faq/
> foros de asp.net, en espa=F1ol :http://asp.net.do/foros/
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
> "shapper" <mdmo...@gmail.com> wrote in messagenews:93187d96-3ff0-4157-956f=
-d6d1bdbc12cc@r66g2000hsg.googlegroups.com...
> > On May 8, 3:13 pm, "Mark Rae [MVP]" <m...@markNOSPAMrae.net> wrote:
> >> "shapper" <mdmo...@gmail.com> wrote in message
>
> >>news:811ff1c6-7f0c-4849-96e4-7d55f109b3f7@a23g2000hsc.googlegroups.com..=
.
>
> >> > I added a class but whatever I do the class is not visible to my aspx=

> >> > pages or anywhere else.
>
> >> > I then changed the property Build Action in my class from Content to
> >> > Compile. Now it is recognized.
>
> >> > Why do I need to do this?
>
> >> Sounds like something's up with your installation of VS.NET, as classes=

> >> (should) have their Build Action property set to Compile by default...
>
> >> --
> >> Mark Rae
> >> ASP.NET MVPhttp://www.markrae.net
>
> > Hi,
>
> > I think the problem is where the classes are being added to.
> > App_Folder or somewhere else.
>
> > I created a Web Application Project.
>
> > When I add a class to App_Folder it VS 2008 makes "Build: Content". If
> > I add the class somewhere else it says "Build: Compile".
>
> > The problem is when I create classes in App_Folder they don't seem to
> > be accessible to ASPX pages as it is usual in Web Site.
>
> > When I changed them "Build: Compile" then I am able to build the
> > solution with no errors but when I preview an ASPX pages I get errors
> > everywhere.
>
> > The only solution I found was to make all classes "Build: Compile" and
> > rename the App_Code folder to New_App_Code.
>
> > I think I am missing something.
>
> > Any idea?
>
> > Thanks,
>
> > Miguel

Sorry, when I wrote App_Folder I meant App_Code ... and that is the
strange problem!

Thanks,
Miguel

Re: Use class ... why is not available? by shapper

shapper
Thu May 08 13:47:22 CDT 2008

On May 8, 6:25 pm, "Juan T. Llibre" <nomailrepl...@nowhere.com> wrote:
> re:
> !> The problem is when I create classes in App_Folder they don't
> !> seem to be accessible to ASPX pages as it is usual in Web Site.
>
> !> The only solution I found was to make all classes "Build: Compile"
> !> and rename the App_Code folder to New_App_Code.
>
> Have you tried putting all your classes in the App_Code folder, instead of=
in your App_Folder folder ?
>
> ASP.NET will not automatically compile classes in application folders,
> but *will* compile classes in source files in the App_Code folder.
>
> Better yet, have you considered compiling your helper classes
> into assemblies and placing the dll's in your app's bin directory ?
>
> Juan T. Llibre, asp.net MVP
> asp.net faq :http://asp.net.do/faq/
> foros de asp.net, en espa=F1ol :http://asp.net.do/foros/
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
> "shapper" <mdmo...@gmail.com> wrote in messagenews:93187d96-3ff0-4157-956f=
-d6d1bdbc12cc@r66g2000hsg.googlegroups.com...
> > On May 8, 3:13 pm, "Mark Rae [MVP]" <m...@markNOSPAMrae.net> wrote:
> >> "shapper" <mdmo...@gmail.com> wrote in message
>
> >>news:811ff1c6-7f0c-4849-96e4-7d55f109b3f7@a23g2000hsc.googlegroups.com..=
.
>
> >> > I added a class but whatever I do the class is not visible to my aspx=

> >> > pages or anywhere else.
>
> >> > I then changed the property Build Action in my class from Content to
> >> > Compile. Now it is recognized.
>
> >> > Why do I need to do this?
>
> >> Sounds like something's up with your installation of VS.NET, as classes=

> >> (should) have their Build Action property set to Compile by default...
>
> >> --
> >> Mark Rae
> >> ASP.NET MVPhttp://www.markrae.net
>
> > Hi,
>
> > I think the problem is where the classes are being added to.
> > App_Folder or somewhere else.
>
> > I created a Web Application Project.
>
> > When I add a class to App_Folder it VS 2008 makes "Build: Content". If
> > I add the class somewhere else it says "Build: Compile".
>
> > The problem is when I create classes in App_Folder they don't seem to
> > be accessible to ASPX pages as it is usual in Web Site.
>
> > When I changed them "Build: Compile" then I am able to build the
> > solution with no errors but when I preview an ASPX pages I get errors
> > everywhere.
>
> > The only solution I found was to make all classes "Build: Compile" and
> > rename the App_Code folder to New_App_Code.
>
> > I think I am missing something.
>
> > Any idea?
>
> > Thanks,
>
> > Miguel

Sorry, when I wrote App_Folder I meant App_Code ... and that is the
strange problem!

Thanks,
Miguel

Re: Use class ... why is not available? by Peter

Peter
Thu May 08 19:25:49 CDT 2008

I am pretty sure that classes in the App_Code folder don't work in a Web
Application Project as you would expect them to in a Web Site project. Put
them next to the aspx pages and they'll get compiled.
Peter
"shapper" <mdmoura@gmail.com> wrote in message
news:1a2b3250-759d-4df2-924b-538291ad210b@f63g2000hsf.googlegroups.com...
On May 8, 6:25 pm, "Juan T. Llibre" <nomailrepl...@nowhere.com> wrote:
> re:
> !> The problem is when I create classes in App_Folder they don't
> !> seem to be accessible to ASPX pages as it is usual in Web Site.
>
> !> The only solution I found was to make all classes "Build: Compile"
> !> and rename the App_Code folder to New_App_Code.
>
> Have you tried putting all your classes in the App_Code folder, instead of
> in your App_Folder folder ?
>
> ASP.NET will not automatically compile classes in application folders,
> but *will* compile classes in source files in the App_Code folder.
>
> Better yet, have you considered compiling your helper classes
> into assemblies and placing the dll's in your app's bin directory ?
>
> Juan T. Llibre, asp.net MVP
> asp.net faq :http://asp.net.do/faq/
> foros de asp.net, en español :http://asp.net.do/foros/
> ======================================
>
> "shapper" <mdmo...@gmail.com> wrote in
> messagenews:93187d96-3ff0-4157-956f-d6d1bdbc12cc@r66g2000hsg.googlegroups.com...
> > On May 8, 3:13 pm, "Mark Rae [MVP]" <m...@markNOSPAMrae.net> wrote:
> >> "shapper" <mdmo...@gmail.com> wrote in message
>
> >>news:811ff1c6-7f0c-4849-96e4-7d55f109b3f7@a23g2000hsc.googlegroups.com...
>
> >> > I added a class but whatever I do the class is not visible to my aspx
> >> > pages or anywhere else.
>
> >> > I then changed the property Build Action in my class from Content to
> >> > Compile. Now it is recognized.
>
> >> > Why do I need to do this?
>
> >> Sounds like something's up with your installation of VS.NET, as classes
> >> (should) have their Build Action property set to Compile by default...
>
> >> --
> >> Mark Rae
> >> ASP.NET MVPhttp://www.markrae.net
>
> > Hi,
>
> > I think the problem is where the classes are being added to.
> > App_Folder or somewhere else.
>
> > I created a Web Application Project.
>
> > When I add a class to App_Folder it VS 2008 makes "Build: Content". If
> > I add the class somewhere else it says "Build: Compile".
>
> > The problem is when I create classes in App_Folder they don't seem to
> > be accessible to ASPX pages as it is usual in Web Site.
>
> > When I changed them "Build: Compile" then I am able to build the
> > solution with no errors but when I preview an ASPX pages I get errors
> > everywhere.
>
> > The only solution I found was to make all classes "Build: Compile" and
> > rename the App_Code folder to New_App_Code.
>
> > I think I am missing something.
>
> > Any idea?
>
> > Thanks,
>
> > Miguel

Sorry, when I wrote App_Folder I meant App_Code ... and that is the
strange problem!

Thanks,
Miguel


Re: Use class ... why is not available? by Juan

Juan
Fri May 09 01:35:46 CDT 2008

re:
!> classes in the App_Code folder don't work in a Web Application Project

AFAIK :

By default, only class files of Web application projects are compiled
by MSBuild when the Build Action property is set to Compile.

However, if a Web Application project includes class files in the App_Code folder,
those class files will be compiled by the ASP.NET compiler.

This is true even if their build action is not explicitly set to Compile.

The App_Code folder exists for Web site projects.

This folder is not included in Web Application projects by default,
although it may be explicitly created and any class files placed in it *will* be compiled.




Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================

"Peter Bromberg [C# MVP]" <pbromberg@nospammaam.yahoo.com> wrote in message
news:0D7C170D-3BF1-4260-B414-8D5570FBECC2@microsoft.com...
>I am pretty sure that classes in the App_Code folder don't work in a Web Application Project as you would expect them
>to in a Web Site project. Put them next to the aspx pages and they'll get compiled.
> Peter
> "shapper" <mdmoura@gmail.com> wrote in message
> news:1a2b3250-759d-4df2-924b-538291ad210b@f63g2000hsf.googlegroups.com...
> On May 8, 6:25 pm, "Juan T. Llibre" <nomailrepl...@nowhere.com> wrote:
>> re:
>> !> The problem is when I create classes in App_Folder they don't
>> !> seem to be accessible to ASPX pages as it is usual in Web Site.
>>
>> !> The only solution I found was to make all classes "Build: Compile"
>> !> and rename the App_Code folder to New_App_Code.
>>
>> Have you tried putting all your classes in the App_Code folder, instead of in your App_Folder folder ?
>>
>> ASP.NET will not automatically compile classes in application folders,
>> but *will* compile classes in source files in the App_Code folder.
>>
>> Better yet, have you considered compiling your helper classes
>> into assemblies and placing the dll's in your app's bin directory ?
>>
>> Juan T. Llibre, asp.net MVP
>> asp.net faq :http://asp.net.do/faq/
>> foros de asp.net, en español :http://asp.net.do/foros/
>> ======================================
>>
>> "shapper" <mdmo...@gmail.com> wrote in
>> messagenews:93187d96-3ff0-4157-956f-d6d1bdbc12cc@r66g2000hsg.googlegroups.com...
>> > On May 8, 3:13 pm, "Mark Rae [MVP]" <m...@markNOSPAMrae.net> wrote:
>> >> "shapper" <mdmo...@gmail.com> wrote in message
>>
>> >>news:811ff1c6-7f0c-4849-96e4-7d55f109b3f7@a23g2000hsc.googlegroups.com...
>>
>> >> > I added a class but whatever I do the class is not visible to my aspx
>> >> > pages or anywhere else.
>>
>> >> > I then changed the property Build Action in my class from Content to
>> >> > Compile. Now it is recognized.
>>
>> >> > Why do I need to do this?
>>
>> >> Sounds like something's up with your installation of VS.NET, as classes
>> >> (should) have their Build Action property set to Compile by default...
>>
>> >> --
>> >> Mark Rae
>> >> ASP.NET MVPhttp://www.markrae.net
>>
>> > Hi,
>>
>> > I think the problem is where the classes are being added to.
>> > App_Folder or somewhere else.
>>
>> > I created a Web Application Project.
>>
>> > When I add a class to App_Folder it VS 2008 makes "Build: Content". If
>> > I add the class somewhere else it says "Build: Compile".
>>
>> > The problem is when I create classes in App_Folder they don't seem to
>> > be accessible to ASPX pages as it is usual in Web Site.
>>
>> > When I changed them "Build: Compile" then I am able to build the
>> > solution with no errors but when I preview an ASPX pages I get errors
>> > everywhere.
>>
>> > The only solution I found was to make all classes "Build: Compile" and
>> > rename the App_Code folder to New_App_Code.
>>
>> > I think I am missing something.
>>
>> > Any idea?
>>
>> > Thanks,
>>
>> > Miguel
>
> Sorry, when I wrote App_Folder I meant App_Code ... and that is the
> strange problem!
>
> Thanks,
> Miguel




Re: Use class ... why is not available? by Mark

Mark
Fri May 09 02:26:33 CDT 2008

I am having the same problem but with Web Applications on VS 2005. Now
I know about the problem it is more of an inconvenience than a problem
for us. I was hoping that this problem would go away when we migrate
to VS 2008 later this month.

Also, Crystal Reports files (rpt) need their type set to content
otherwise the installer does not copy them for installation. Again,
more of an inconvenience than a problem.

Cheers,
Mark

On Thu, 8 May 2008 11:47:22 -0700 (PDT), shapper <mdmoura@gmail.com>
wrote:


>> > I think the problem is where the classes are being added to.
>> > App_Folder or somewhere else.
>>
>> > I created a Web Application Project.
>>
>> > When I add a class to App_Folder it VS 2008 makes "Build: Content". If
>> > I add the class somewhere else it says "Build: Compile".
>>
>> > The problem is when I create classes in App_Folder they don't seem to
>> > be accessible to ASPX pages as it is usual in Web Site.
>>
>> > When I changed them "Build: Compile" then I am able to build the
>> > solution with no errors but when I preview an ASPX pages I get errors
>> > everywhere.
>>
>> > The only solution I found was to make all classes "Build: Compile" and
>> > rename the App_Code folder to New_App_Code.
>>
>> > I think I am missing something.
>>
>> > Any idea?
>>
>> > Thanks,
>>
>> > Miguel
>
>Sorry, when I wrote App_Folder I meant App_Code ... and that is the
>strange problem!
>
>Thanks,
>Miguel
--
|\ _,,,---,,_ A picture used to be worth a
ZZZzzz /,`.-'`' -. ;-;;, thousand words - then along
|,4- ) )-,_. ,\ ( `'-' came television!
'---''(_/--' `-'\_)

Mark Stevens (mark at thepcsite fullstop co fullstop uk)

This message is provided "as is".