Sunday, February 3, 2008

Error loading AJAX Control Toolkit in Visual Studio 2008

I have used AJAX in ASP.NET way back when it was still codenamed ATLAS. In Visual Studio 2008, AJAX has already been integrated as part of the framework and is now easy to use unlike when it was still called ATLAS. Unfortunately, though, the AJAX Control Toolkit isn't. It is a shared source project built on top of the Microsoft ASP.NET AJAX framework and is a joint effort between Microsoft and the ASP.NET AJAX community that provides a powerful infrastructure to write reusable, customizable and extensible ASP.NET AJAX extenders and controls, as well as a rich array of controls that can be used out of the box to create an interactive Web experience. The fact that it is a "community" project makes it a non-Microsoft supported product. But, of course, nobody is stopping you from taking full advantage of the toolkit.

If you're like me who has both Visual Studio 2005 and 2008 running on the same machine, chances are that you will start using this toolkit. You simply download the files from CodePlex and add the assembly in your Toolbox. The challenge begins when you realized that you downloaded the incorrect version and you get this error message or something similar

There was an error loading types from assembly 'C:\Program Files\AJAX Control Toolkit\Binaries\AjaxControlToolkit.dll''Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture= neutral, PublicKey Token=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'

Make sure that you downloaded the one with the Framework3.5 in the filename if you plan to use it in Visual Studio 2008. Otherwise, use the AJAX v1.0 for ASP.NET v2.0
Google