Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > BOOK: Professional ASP.NET 3.5 SP1 Edition: In C# and VB
Password Reminder
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 Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 4th, 2009, 10:08 PM
Registered User
 
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?
  #2 (permalink)  
Old September 5th, 2009, 06:31 AM
Imar's Avatar
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 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
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!
  #3 (permalink)  
Old September 5th, 2009, 09:00 PM
Registered User
 
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.
  #4 (permalink)  
Old September 6th, 2009, 06:59 AM
Imar's Avatar
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!
  #5 (permalink)  
Old October 14th, 2009, 01:59 PM
Authorized User
 
Join Date: Sep 2009
Posts: 23
Thanks: 9
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
  #6 (permalink)  
Old October 14th, 2009, 02:11 PM
Authorized User
 
Join Date: Sep 2009
Posts: 23
Thanks: 9
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
 


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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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 11:00 AM
Chapter 2 - date code problems Memr2249 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 July 6th, 2009 09: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 08:39 PM



All times are GMT -4. The time now is 06:10 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.