p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > ASP.NET and ASP > ASP.NET 3.5 > BOOK: Professional ASP.NET 3.5 SP1 Edition: In C# and VB
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional ASP.NET 3.5 SP1 Edition: In C# and VB
This is the forum to discuss the Wrox book Professional ASP.NET 3.5 SP1 Edition: In C# and VB by Bill Evjen, Scott Hanselman, and Devin Rader; ISBN: 9780470478264

Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 3.5 SP1 Edition: In C# and VB section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 4th, 2009, 11:08 PM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problems with BuildProvider code (chapter 1)

I'm getting an error, "Could not load type CarBuilderProvider.Car" when I attempt to compile the code in chapter 1. The .car file I have is below:

<?xml version="1.0" encoding="utf-8" ?>
<car name="SamsCar" >
<color>Blue</color>
<door>4</door>
<speed>123</speed>
</car>

And the XML snippet from the web.config file is below:

<buildProviders>
<add extension=".car" type="CarBuilderProvider.Car" />
</buildProviders>

I didn't modify the buildProvider code from the solutions at all.

Any ideas?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old September 5th, 2009, 07:31 AM
Imar's Avatar
Wrox Author
Points: 33,539, Level: 80
Points: 33,539, Level: 80 Points: 33,539, Level: 80 Points: 33,539, Level: 80
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 10,227
Thanks: 7
Thanked 202 Times in 200 Posts
Default

Hi there,

Looks like you maybe missing a reference to the DLL containing your build provider? Maybe this helps:

http://social.msdn.microsoft.com/For...-7e1fa8f2ae28/

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004

Did this post help you? Click the button to show your appreciation!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old September 5th, 2009, 10:00 PM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Thanks - Got it working

The trick here is to create a separate project and compile the BuildProvider as a .net .dll. Then in the ASP.NET website, that buildprovider .dll must be added as a reference...It seems that when you do that, it ends up going into the /bin folder (which I had added manually to the ASP.NET website).

There's not a description of those steps in the book...from the text it sounds like you would have the carbuildprovider.cs class in the app_code folder, but that will not work. The only thing related to the build provider in the app_code folder is the XML snippet that defines the car. You have to compile it and have it in the /bin folder. The screen shot (image 1-15 is helpful to look at, but in some ways it muddies the water by showing an app_data folder which I don't think is needed at all).

Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old September 6th, 2009, 07:59 AM
Imar's Avatar
Wrox Author
Points: 33,539, Level: 80
Points: 33,539, Level: 80 Points: 33,539, Level: 80 Points: 33,539, Level: 80
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 10,227
Thanks: 7
Thanked 202 Times in 200 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
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004

Did this post help you? Click the button to show your appreciation!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #5 (permalink)  
Old October 14th, 2009, 02:59 PM
Authorized User
Points: 108, Level: 2
Points: 108, Level: 2 Points: 108, Level: 2 Points: 108, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2009
Posts: 23
Thanks: 7
Thanked 1 Time in 1 Post
Default

DevonTaig & Imar,

I'm stumped on this one as well. I've added a reference to the compiled CarBuildProvider.dll which adds it to the Bin folder as was stated here and not in the book, yet I don't get Intellisense for the properties and method even though the class name itself can be accessed via Intellisense. All I see in Intellisense is Equals and ReferenceEquals.

Additionally, I also learned that if you have to recompile the CarBuildProvider.dll for whatever reason, your Website won't get a fresh copy of it. In order to get a new copy you have to right-click on the CarBuilderProvider.dll file within the Bin folder and select "Update Reference".

Any help would be greatly appreciated.

Thanks,

John
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #6 (permalink)  
Old October 14th, 2009, 03:11 PM
Authorized User
Points: 108, Level: 2
Points: 108, Level: 2 Points: 108, Level: 2 Points: 108, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2009
Posts: 23
Thanks: 7
Thanked 1 Time in 1 Post
Default

Sorry,

Posted to soon. I found the mistake. I previously had:

Code:
dim myCar as New Eclipse
' Got Equals and ReferenceEquals in Intellisense after typing the period here
Label1.Text = Eclipse.
When it should have been this (Note: The Intellisence worked as expected here):
Code:
dim myCar as New Eclipse
Label1.Text = myCar.Color
Thanks,

John
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
BuildProvider example not working bradnerdhss BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 2 August 26th, 2009 12:00 PM
Chapter 2 - date code problems Memr2249 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 July 6th, 2009 10:59 AM
Chapter 5 Code, problems? tmorgan BOOK: Beginning Access 2003 VBA 3 February 12th, 2007 07:26 AM
Chapter 11 Code Problems vbswshare BOOK: Professional VB 2005 ISBN: 0-7645-7536-8 3 April 9th, 2006 09:39 PM
chapter 12 - problems with understanding the code Luke24 BOOK: Beginning Dreamweaver MX/MX 2004 MX ISBN: 978-0-7645-4404-0; MX 2004 ISBN: 978-0-7645-5524-4 3 May 25th, 2004 08:08 AM



All times are GMT -4. The time now is 09:31 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc