Friday, November 30, 2007

RadControls and VS 2008, .NET 3.5

As everybody knows by now, VS 2008 and .NET 3.5 were released last week. If you have a MSDN/TechNet subscription, you have probably already downloaded a copy (retail copies still won't be available for a couple of months). One of the biggest impacts of this release is that the previously separate ASP.NET AJAX Extensions are now an integrated component of the .NET 3.5 assembly. That means controls that reference ASP.NET AJAX (a.k.a. System.Web) classes need to be "updated" to work in VS 2008.

There are actually two ways you can update your controls to work with .NET 3.5:

  1. Install new versions of the controls built directly against .NET 3.5
  2. Add binding redirects to your web.config file
Both methods work equally well and there are very few situations that actually need new versions of controls built against .NET 3.5. In fact, so far Telerik has only identified one scenario where you will need a new version of the RadControls to work in VS 2008. If you have a computer with VS 2008 installed and you don't also have the older ASP.NET AJAX Extensions installed, you'll need a new version of the RadControl assemblies to get toolbox support. Other than that, the version of RadControls you're using today already works perfectly in VS 2008 with .NET 3.5 and a simple binding redirect.

For those who have never seen a binding redirect, it is a small piece of configuration code added to your site's web.config file that points references to one version of an assembly to another. In the case of the RadControls, any references to System.Web 1.x will automatically be re-routed to the 3.5 assemblies. Visual Studio 2008 will even add these redirects automatically in many cases, but if you need to add them manually the code looks like this:

<runtime>
<assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentassembly>
<assemblyidentity name="System.Web.Extensions" publickeytoken="31bf3856ad364e35" />
<bindingredirect oldversion="1.0.0.0-1.1.0.0" newversion="3.5.0.0" />
</dependentassembly>
<dependentassembly>
<assemblyidentity name="System.Web.Extensions.Design" publickeytoken="31bf3856ad364e35" />
<bindingredirect oldversion="1.0.0.0-1.1.0.0" newversion="3.5.0.0" />
</dependentassembly>
</assemblybinding>
</runtime>

So while some component vendors have rushed to encourage you to replace all of your control assemblies with new .NET 3.5 versions, the truth is you likely don't need to do that. But in the case that you do need a .NET 3.5 version, Telerik will be providing a native build soon. Hopefully this will save you some time on your projects and clear-up some of mystery about binding redirects. If you still have questions about Telerik and VS 2008, don't miss Ivo's blog post on the Telerik Blogs.

2 comments:

Unknown said...

if you've already set up your site to use Sysetm.Web.Extensions 3.6.0.0, you can actually just change the "oldversion" to "1.0.0.0-3.6.0.0" (with newverion ="3.5.0.0") and it will bind it down to the right version as well.

Anonymous said...

i've added reference to Telerik.Web.UI to my MOSS solution, and manually added the redirect bindings to my web.config. Unfortunately when I access the page with my web part I get a javascript error "Error: Sys.InvalidOperationException: Handler was not added through the Sys.UI.DomEvent.addHandler method."