|
|
 |
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.
|
 |

September 4th, 2009, 11:08 PM
|
|
Registered User
|
|
Join Date: Sep 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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?
|

September 5th, 2009, 07:31 AM
|
 |
Wrox Author
Points: 33,539, Level: 80 |
|
|
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 10,227
Thanks: 7
Thanked 202 Times in 200 Posts
|
|
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
|

September 5th, 2009, 10:00 PM
|
|
Registered User
|
|
Join Date: Sep 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|

September 6th, 2009, 07:59 AM
|
 |
Wrox Author
Points: 33,539, Level: 80 |
|
|
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 10,227
Thanks: 7
Thanked 202 Times in 200 Posts
|
|
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
|

October 14th, 2009, 02:59 PM
|
|
Authorized User
|
|
Join Date: Sep 2009
Posts: 23
Thanks: 7
Thanked 1 Time in 1 Post
|
|
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
|

October 14th, 2009, 03:11 PM
|
|
Authorized User
|
|
Join Date: Sep 2009
Posts: 23
Thanks: 7
Thanked 1 Time in 1 Post
|
|
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 |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |