LA.NET [EN]

Oct 26

In the last days I”ve seen several guys reporting problems while deploying ASP.NET AJAX applications to servers which only have  ASP.NET 2.0 + ASP.NET AJAX 1 installed. Generally, the error that has been reported is:

Could not load file or assembly ”System.Web.Extensions, Version=3.5.0.0…

One of the suggestions that I have seen is to add a redirect on the web.config app so that all requests made to the 3.0 dll are redirected to the 1.0 version of the dll. Even though most guys said that this worked, I didn”t though it was the correct thing to do since I was positive that if you specify the correct version of the ASP.NET Ajax dll on the config file and that file existed on the server then you should get that file and not the most recent version.

Today, I”ve  finally managed to get a repro web app from Johnson (thanks!).Since this kind of thing will only happen if you have the .Net 3.5 framework installed, I started by looking at the web.config file. I though that VS might have changed the dll version silently, but no, that was not the case. Then I asked Johnson how he was deploying the app and he told me that he was publishing the app from within the VS. Since I”m running VS 2008 standard, I don”t have that option here. So I asked him to publish the site and sent it to me by mail. This was really a simple site that only had one page with an UpdatePanel (or something simple like that)

After looking at the pre-compiled version, the problem was obvious: the assembly that was placed inside the /bin folder (built automatically  when you publish the web app form within VS ) had a dependency on the 3.5 version of the System.Web.Extensions assembly!

The moral of the story is simple: if you”re using VS 2008 and you want to build a 1.0 ASP.NET AJAX web app to deploy on a server which is running version 2.0, then don”t forget to set up the version you”re compiling against on the property pages of the web project. This is specially true when you”re using the publish option, since it”ll pre-compile the web app and this will create dependencies between the resulting dlls and the platform dlls (which might not be installed on the server where you”re deploying the app).

You should also pay attention to external dlls that are added to your project. For instance,if you”re using the AJAX Toolkit,then you should check its dependencies and make sure that it was built against the correct version of System.Web.Extensions.dll.

9 comments so far

  1. Trevor
    9:21 pm - 12-17-2007

    Thanks for identifying the cause of the problem, but I don”t understand how to fix. Using VS2005, what do I need to do in property pages? I used to have my app running but since i installed VS2008 it doesn”t work when I publish to server.

  2. Luis Abreu
    10:38 pm - 12-17-2007

    hello.
    in this case the problem was that the web app is configured to user .net 2.0 but the ajax toolkit dll taht was copied into the bin folder was compiled against the 3.5 version….

  3. Sandhu
    3:28 pm - 5-15-2008

    Hi,

    I read your page, its really good. I also had the same problem. Mine solved by deleting the line

    Then I changed it to

    But I still receive the same error so finally I deleted this. Now Ajax and the page , both are working fine.

  4. sarah
    12:50 pm - 1-30-2009

    Hi! I”m getting the error even though the version in the property pages is correct. here”s what I have:
    AjaxControlToolkit BIN AutoUpdate
    AJAXExtensionsToolbox BIN 1.0.61025.0

    Please help.. thanks in advance 🙂

  5. luisabreu
    2:19 pm - 1-30-2009

    if i recall correctly, the problem are the dependencies. In this example, what was happening was the sitee was being built against .NET 3.5 on VS and published on a machine which only had .NET 2..0 installed. Have you checked that this is not happening with you?

  6. John
    4:59 am - 6-23-2009

    I have a similar problem. I have VS 2008 and The 3.5 Version of the control toolkit. I”ve been asked to work on a website that was built in 2005 using the older toolkit. I obviously can”t add the 3.5 toolkit to the site and when I try to build it, it says it can”t find the 1.0.61025.0 version… Can I have both toolkits installed?

    Thank in advance…

  7. Danny
    3:21 am - 12-22-2009

    In my case, I found that I had framework 3.5 sp1 installed on my dev machine, but didn”t have sp1 on the server. I looked in the windows/assembly folder and was missing the .dll”s in question.

  8. Sergio
    9:21 pm - 4-30-2010

    If i load the System.Web.Extension into the bin folder will then reference this, could this help?