View Single Post
  #4 (permalink)  
Old September 6th, 2009, 06:59 AM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi DevonTaig,

I don't have the book so I don't know what the original instructions were, but I just created a quick test site with just the App_Code folder and it worked fine. Here's what I did:

1. Create a class that inherits BuildProvider in its own namespace in App_Code

2. Created an override for GenerateCode in that class

3. Added the provider to the web.config like this:
Code:
 
<buildProviders>
<add extension=".sample" type="MyNamespace.MyClassname" />
</buildProviders>
4. Created a .sample file

5. Fired up a second instance of Visual Studio and debugged the first one with the web site and the build provider.

6. As soon as I start running the site with the build provider, my breakpoint in GenerateCode gets hit.

So, it seems to work fine when using App_Code.

Are you using a Web Site Project or a Web Application Project? App_Code is not used in WAPs....

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!