Monday, February 22, 2010

AJAX Control Toolkit and .NET 4.0

If you would like to build a .NET 4.0 web application with Visual Studio 2010, and you would like to build the AJAX Control Toolkit from its source with .NET 4.0 as well, you may run into a little problem. Even though you can build the AJAX Control Toolkit itself just fine, but when you build your web application, the compiler will give an error: "Inheritance security rules violated by type: 'AjaxControlToolkit.TabPanelDesigner'. Derived types must either match the security accessibility of the base type or be less accessible."

A quick solution to this problem is to add the following to the "AssemblyInfo.cs" file of the AJAX Control Toolkit project (not your own web application project):

[assembly: SecurityRules(SecurityRuleSet.Level1)]

Of course, at the beginning of this file, make sure that you have

using System.Security;

After you have made these changes, rebuild the AJAX Control Toolkit, and then your web application. Your web application should build fine.

Update: A later build of AJAX Control Toolkit now works with Visual Studio 2010 without modification.

2 comments: