Today, I have compiled one of my .NET 2.0 web projects (using Visual Studio 2005) and after I have deployed it on the web server and loaded the index page, the following error occurred:  

Could not load file or assembly 'System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

System.Web.Extensions.dll is the ASP.NET AJAX assembly that needs to be installed in the global assembly cache (GAC) on the web server. The version of the System.Web.Extensions.dll used is specified in the web.config. For my project, the version used is 1.0.61025.0:

<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">      </sectionGroup>

Even though the version specified was 1.0.61025.0, the page was trying to load 3.5.0.0 version. After a quick search on Google I found out that Version 3.5.0.0 comes with .NET Framework 3.5.

So what was the relation between my .NET 2.0 project compiled using Visual Studio 2005 and .NET Framework 3.5? Pretty obvious, isn’t it? Several weeks ago I have installed Visual Studio 2008 Beta 2 and implicitly .NET Framework 3.5. On the Visual Studio 2008 Beta 2 download page they say:

IMPORTANT: After the Beta 2 installation has finished, you should run this script to ensure that the installation of .NET Framework 3.5 Beta 2 will not affect the development of ASP.NET AJAX 1.0 applications.

As you can imagine, I did not run the script as I did not planned to develop AJAX applications using Visual Studio 2008. What I did not know was that the instalation of the Visual Studio 2008 was affecting my existing AJAX projects. It seems that somehow when the project is compiled it references the version 3.5.0.0 of the System.Web.Extensions.dll, instead of 1.0.61025.0. The script fixes the problem!

So be careful: when you install Visual Studio 2008 Beta 2 don’t forget to run the script! It is important! :)

Related posts:

  1. Visual Studio 2008 launching this year It's official: Visual Studio 2008 and the .NET Framework 3.5...
  2. C# 3.0: Querying XML in C# with LINQ to XML LINQ to XML is a built-in LINQ data provider that...
  3. What is a WPF Browser Application? When I created my first application using Visual Studio 2008...
  4. Visual Studio 2008 (Orcas) Beta 2 este disponibil pentru download Microsoft a anuntat ca Visual Studio 2008 Beta 2 si...
  5. Implementing a WPF Browser Application WPF Browser Applications, a.k.a. XAML Browser Applications, are Windows Presentation...