Contents tagged with WAP

  • Web Profile Builder

    It's been over five years since I've made any updates to this project.  I had basically

    left it for dead because I personally no longer have a need for it.  I know a lot of

    people do still rely on it though.  I had some free time recently so I decided to give

    the project a little bump to make it easier to use and more accessible to those who do

    still use it.



    What's changed?

    • Most importantly, this is no longer required to be installed in the GAC.
      • There is no installer at all anymore!
      • Now it can be included in the project source control and referenced
    • Added support to install using NuGet.
      • PM> Install-Package WebProfileBuilder
    • Simplified the configuration.
      • Support for configuration via Web.config has been removed. This was
        more of a "nice to have" feature and added unneeded complexity to
        the code base.
      • All configurable options are still supported, but now it has to be
        configured in the web project file.  See below for a complete
        example of the configuration.
    • Moved project home to CodePlex.
    • Added build automation to the source code using NAnt.




    • The core code base has not been changed.  I didn't want to introduce any bugs, so
      I only changed the code necessary to achieve my goal.  All code changes were
      related to configuration.
    • If you are new to WebProfileBuilder, know the following:
      • The generated profile class does not get automatically included into the
        project.  You must use the Solution Explorer to show all files, then
        manually include the generated class into your project.  You only
        need to do this once.
      • You also must create the "Profile" property in your Page class. See
        below for an example.



    Example web project file:

    <?xml version="1.0" encoding="utf-8"?>

    <Project ToolsVersion="4.0"




        <!-- ... other project content ... -->


        <!--WebProfileBuilder setup.-->

        <UsingTask TaskName="BuildWebProfile"



        <Target Name="BeforeBuild">

            <!--WebSiteRoot, RootNamespace, and Language are required.-->

            <!--ClassName, Directory, and FileName are optional for additional customization.-->

            <BuildWebProfile WebSiteRoot="$(ProjectDir)"





                             FileName="MyWebProfile" />



        <!-- ... other project content ... -->





    Example page class:

    using System;

    using System.Collections.Generic;

    using System.Web.UI;


    namespace CsExample {

        public partial class _Default : Page {

            //... other class content ...


            public static MyWebProfile Profile {

                get { return MyWebProfile.Current; }



            //... other class content ...




  • Web Profile Builder Released

    Files can be downloaded from the Web Profile Builder project page.

    If you are unfamiliar with Web Profile Builder, you can read my initial blog post about it here.

    Changes made for release

    • Added the ability to detect changes made to the profile section of the web.config file
      and only rebuild the Profile class if changes have been made.


    • If you used the previous release, remember to uninstall it first.
    • Also, if you used the previous release and added the customize section in the
      web.config file, remember to update the assembly reference to
      “WebProfileBuilder.WebProfileConfigurationSection, WebProfileBuilder, Version=,
      Culture=neutral, PublicKeyToken=01d50f1f82943b0c”.

    Thank you to everybody who provided me with valuable feedback.  This release should address
    all of your concerns.



  • Web Profile Builder for Web Application Projects

    Files can be downloaded from the Web Profile Builder project page.

    If you use Web Application Projects, you have probably run into the issue of not being
    able to access the Profile at design time.

    Thankfully, some nice people created an Add-In for Visual Studio 2005 that will generate
    a wrapper class as a workaround.  That project can be found here.  I wanted to contribute
    to the Web Profile Generator project, but my emails went unanswered.  I decided to start
    a new project.

    This project picks up where that one left off and is based on their source code.  I started
    out rebuilding that project as it stood to add support for Visual Studio 2008.  I got it to
    work, but I wanted to do more. 

    I decided to go ahead and address the issues listed on the original project site.

    Here is a summary of the changes made.

    • First of all, this is no longer an Add-In.  Instead, it is a Build Task.
    • Works for Visual Studio 2005 and 2008.
    • Added ability to set the file name.
    • Added ability to set the directory the file gets created in.
    • Added ability to set the class name.
    • Added ability to set the name space.
    • Added an extra method as requested here.


    1. Run the installer.
    2. Add this Import statement to your project file.  (see special notes below)
      <Import Project="$(MSBuildExtensionsPath)\WebProfileBuilder\WebProfileBuilder.targets" />
    3. Done.

    The profile will get generated every time you build the project.

    Special Notes:

    After you modify the project file by adding the import statement, you will get this security
    warning when the project loads.  Choose the "Load project normally" option and press OK.

    Extended Usage:

    If you want to customize the web profile, you can add the following sections to your web.config.

    This section needs to be at the top of the file just under the opening configuration tag.
    <sectionGroup name="robo.webProfile">
    <section name="webProfileSettings"
    type="WebProfileBuilder.WebProfileConfigurationSection, WebProfileBuilder, Version=, Culture=neutral, PublicKeyToken=01d50f1f82943b0c"

    This section can be anywhere under the configuration section.
    <webProfileSettings className="MyWebProfile"
    fileName="MyWebProfile" />

    The directory name is not a virtual directory, but is in reference to the root of the Web Application.
    The fileName is just the name of the file and should not include an extension.
    The className and nameSpace are as you would expect.
    None of these settings are required.  You don't even need to define this section at all.

    If you would like to use Web Profile Builder, it can be downloaded here.
    Also available is the complete source code and examples in VB and C#.