Building the IE WebControls VS.NET Solution
By Peter A. Bromberg, Ph.D.
Printer - Friendly Version
Peter Bromberg

Microsoft has done a great service to the .Net developer community by releasing the source code to the IE WebControls for ASP.NET. Unfortunately, they have also done a great disservice in the process by releasing this code in the form of all the .cs class files and resources with only a build script, no Visual Studio.NET solution at all. If you look at the forum posts on asp.net (as well as the many posts at our own forums) you will see that there are a lot of frustrated developers who don't even know how to set the VS.NET environment variables in order to get the batch build script to function properly, much less to be able to bring all these files and the correct resources and settings into a solution, build it, and be able to test out and debug or step through the code to see how this animal actually works.



Since I've always been a big fan of ServerControls, and since the IE WebControls are excellent examples of top-notch C# programming style and technique, I decided to tackle the problem of getting all this into a real Solution, making sure it compiles properly, and that it runs! It's not an easy task, but I got it done. I don't know of too many developers who write complex ServerControls like these in Notepad, and I strongly suspect that the MS guys who worked on this used the IDE for it, so I just don't understand why they would take such a nasty shortcut when deciding to release the source code for them.

There are a couple of issues that you should be aware of here. First, the information specifies that the runtime files consisting of all the HTC's and images need to be copied into a webctrl_client folder in your IIS root (e.g., in "C:\Inetpub\wwwroot"). Unfortunately, its subfolder "1_0" that holds all these resources didn't work with the default build, because the Solution actually will be looking for them in a "0_0" folder! Finally I figured out that it was adding the Major and Minor version numbers of the assembly to make the path, and there was no AssemblyInfo.cs file in the source! So I added one and set it to "1.0.0.0" which creates the correct "1_0" path. Then I found that there is a "Version.cs" file that has the Assembly version directives instead of the customary "Assemblyinfo.cs", so I rebuilt it and included that.

Second, you should be aware that in VS.NET 2003,(Framework version 1.1) the XmlTransform method now expects a derivative of the abstract class XmlResolver. MIne still compiled, but you can try adding an XmlUrlResolver instance parameter after the stream parameter in calls to the XmlTransform method (this would be in the TreeView control code). I don't know if this is deprecated or whether it is a breaking change, but you should be aware of it.

In order to build this and get it to run, first unzip the source tree into a new folder under wwwroot called "IEWebControlsSoln". Then, right-click on the "webcontroltest" subfolder, choose the Web Sharing tab, and share the folder as as IIS virtual root. Finally, copy the subfolder "webctrl_client" and all its contents under your wwwroot folder, which is its proper location.

Make sure the "webcontroltest" subproject is marked as the startup project, and that the WebForm1.aspx page is marked as the Start Page. Then build the solution. Debug will be fine for now. Finally, right click on a spare area of one of your Toolbox tabs and choose "Add/Remove Items" (in VS.NET 2003) or "Customize Toolbox" (in VS.NET 2002) and BROWSE to the newly built Microsoft.Web.UI.WebControls.dll to bring it in. You should now see the icons for the Multipage, TabStrip, Toolbar and TreeView contols on your Toolbox section.

You can now simply drag any of the controls on to your Web Form designer surface, and use the Properties Page to configure the properties. I'm not going to go into any detail about how to use the controls here; there is extensive documentation about these controls at MSDN online.

NOTE: The zip file contains a Visual Studio.NET 2003 Solution and subproject files. If you are still using Visual Studio.NET 2002, you can use my conversion utility from a recent article here to "back convert" it for VS.NET 2002. It will work and compile in both versions. One last caveat: we get lots of questions about these controls, probably because I wrote a couple of articles on them here early on. Please don't expect a lot of support for your IE WebControls issues here; there are newsgroups with topics on this at asp.net, and extensive downloadable / searchable documentation at the MSDN online site. You'd think that with all the interest and the documentation they've put together (all of which carries the red "no longer supported" disclaimer) that they would have taken the time to put together a Visual Studio.NET Solution rather than just a build script, but they didn't. So, here it is!

Finally, as a little added "bonus", I used NDoc and the HTML Help Compiler to make up a nice IEWebControls.CHM compiled help file which you can download separately.

Download the code that accompanies this article


Peter Bromberg is a C# MVP, MCP, and .NET consultant who has worked in the banking and financial industry for 20 years. He has architected and developed web - based corporate distributed application solutions since 1995, and focuses exclusively on the .NET Platform.