Using Microsoft AJAX Control Toolkit with Visual Studio 10 Beta 1
In this post we will talk about the effects of a particular security enhancement in CLR 4.0 Beta 1 and how it affects working with AJAX Control Toolkit in Visual Studio 10 Beta 1 and possibly other 3-rd party assemblies.
The security enhancement in question is the way CLR 4.0 treats assemblies that came from a remote source (e.g., downloaded from the Internet or copied from a file share of another computer). Prior to CLR 4.0, if such assembly was copied to a local drive on your computer, CLR would treat it as a trusted assembly coming from My Computer zone. This is different from how Windows was treating such assemblies. Downloaded assemblies are marked with a special “Internet” bit and should not be trusted unless a user explicitly grants trust to them. This behavior was implemented in CLR 4.0 Beta 1. Unfortunately, it causes a somewhat obscure error message when working with such assemblies in Visual Studio 10 Beta 1. In particular, this error message happens when you attempt to add controls from such assembly to Visual Studio Toolbar. We will certainly improve the error message or may bypass this security check in this particular scenario in Visual Studio 10 Beta 2, but for now the users should understand what that error message means and the action required from them to give trust to downloaded assemblies that they wish to use in Visual Studio.
Please note that this issue should affect only assemblies downloaded as a plain DLL assembly file, or as a part of a ZIP archive. Third-party assemblies installed by a downloaded executable installer should not be affected by this issue.
As mentioned above, the issue manifests when attempting to add controls from a downloaded assembly to Visual Studio 10 Beta1 Toolbox. In particular, the issue affects AJAX Control Toolkit since it is currently made available for download as a ZIP archive. If the user right-clicks on the toolbox and selects “Choose Items” from the context menu
and browses to the AJAX Control Toolkit assembly
they will get the following error message when adding the items
Could not load file or assembly ‘file:///E:DownloadAJAX 1.0ToolkitAjaxControlToolkit-NoSourceSampleWebSiteBinAjaxControlToolkit.dll’ or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
In order to be able to add controls from the assembly to the toolbox, the user should grant the needed permissions to the assembly. It should be done by going to the assembly file properties in Windows Explorer
and clicking the “Unblock” button
After that, you should be able to add AJAX Control Toolkit to the toolbox and use it as you did in previous version of Visual Studio.