Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Professional ASP.NET 4 : in C# and VB
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: Professional ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Professional ASP.NET 4 in C# and VB by Bill Evjen, Scott Hanselman, Devin Rader; ISBN: 9780470502204
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 4 : 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 January 27th, 2013, 04:42 AM
Authorized User
Points: 90, Level: 1
Points: 90, Level: 1 Points: 90, Level: 1 Points: 90, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Aug 2012
Posts: 19
Thanks: 8
Thanked 0 Times in 0 Posts
Default Chapter1 : CarBuildProvider web.config error


i've made my build provider as you said in section (USING YOUR OWN BUILD PROVIDER) but it has one error : Could not load type 'CarBuildProvider.Car'

thank you.

here is my Codes:
using System.IO;
using System.Web.Compilation;
using System.CodeDom;
using System.Xml;

/// <summary>
/// Summary description for CarBuilderProvider
/// </summary>
namespace CarBuildProvider
  public class Car : BuildProvider
    public override void GenerateCode(AssemblyBuilder myAb)
      XmlDocument carXmlDoc = new XmlDocument();
      using (Stream passedFile = OpenStream())
      XmlNode mainNode = carXmlDoc.SelectSingleNode("/car");
      string selectionMainNode = mainNode.Attributes["name"].Value;

      XmlNode colorNode = carXmlDoc.SelectSingleNode("/car/color");
      string selectioncolorNode = colorNode.InnerText;

      XmlNode doorNode = carXmlDoc.SelectSingleNode("/car/door");
      string selectionDoorNode = doorNode.InnerText;

      XmlNode speedNode = carXmlDoc.SelectSingleNode("/car/speed");
      string selectionSpeedNode = speedNode.InnerText;

      CodeCompileUnit ccu = new CodeCompileUnit();
      CodeNamespace cn = new CodeNamespace();
      CodeMemberProperty cmp1 = new CodeMemberProperty();
      CodeMemberProperty cmp2 = new CodeMemberProperty();
      CodeMemberMethod cmm1 = new CodeMemberMethod();

      cn.Imports.Add(new CodeNamespaceImport("System"));

      cmp1.Name = "Color";
      cmp1.Type = new CodeTypeReference(typeof(string));
      cmp1.Attributes = MemberAttributes.Public;
      cmp1.GetStatements.Add(new CodeSnippetExpression("return \"" + selectioncolorNode + "\""));

      cmp2.Name = "Doors";
      cmp2.Type = new CodeTypeReference(typeof(int));
      cmp2.Attributes = MemberAttributes.Public;
      cmp2.GetStatements.Add(new CodeSnippetExpression("return" + selectionDoorNode));

      cmm1.Name = "Go";
      cmm1.ReturnType = new CodeTypeReference(typeof(int));
      cmm1.Attributes = MemberAttributes.Public;
      cmm1.Statements.Add(new CodeSnippetExpression("return" + selectionSpeedNode));

      CodeTypeDeclaration ctd = new CodeTypeDeclaration(selectionMainNode);


      myAb.AddCodeCompileUnit(this, ccu);

web.config Code :
    <compilation debug="false">
        <add extension=".car" type="CarBuildProvider.Car"/>
and .car code :
<?xml version="1.0" encoding="utf-8" ?>
<car name="EvjenCar">

Last edited by kafshdoozak; January 27th, 2013 at 04:53 AM..

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
Error in Web.config.. ashokparchuri General .NET 10 April 30th, 2011 05:14 AM
Web.config Error Janhemberg@hotmail.com BOOK: Beginning ASP.NET 4 : in C# and VB 3 August 6th, 2010 03:12 AM
Fix for Web.config Error in ...\Chapter01\LINQforBinding Web Sites rogerj BOOK: Professional ADO.NET 3.5 with LINQ and the Entity Framework ISBN: 978-0-470-22988-0 0 February 18th, 2009 01:59 PM
web.config error koco ASP.NET 2.0 Basics 1 February 16th, 2007 12:04 PM
Web.config error ashokparchuri General .NET 4 June 28th, 2005 04:51 AM

All times are GMT -4. The time now is 10:21 AM.

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