locked
system.web.extensions could not be loaded ... .NET 3.5 RRS feed

  • Question

  • User-18919477 posted

    I saw a few other threads on this but some were locked, though it better to start a fresh thread.   I solve this issue but would like to understand what was happening --

    Working with an old ASP.NET app built on VS2010, imported it into VS 2017, managed to get everything to compile, but there are a handful of old DLLs for which I don't have source code.  One of them is ComponentArt.Web.UI, an old DLL which references an older version (1.0.61025.0) of System.Web.Extensions, whereas all that I could reference from the framework list was a 3.5 version.  Using binding redirection I was able to get the compile to work, but when I ran the app I got this on the web page:



    Server Error in '/' Application.

    Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

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

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.

    === Pre-bind state information ===
    LOG: User = administrator
    LOG: DisplayName = System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
    (Fully-specified)
    LOG: Appbase = file:///C:/Users/administrator/Documents/Visual Studio 2017/Projects/Rs/Rs.App/
    LOG: Initial PrivatePath = C:\Users\administrator\Documents\Visual Studio 2017\Projects\Rs\Rs.App\bin
    Calling assembly : ComponentArt.Web.UI, Version=2007.1.1512.3, Culture=neutral, PublicKeyToken=9bc9f846553156bb.
    ===
    LOG: This bind starts in default load context.
    LOG: Using application configuration file: C:\Users\administrator\Documents\Visual Studio 2017\Projects\Rs\Rs.App\web.config
    LOG: Using host configuration file: C:\Users\administrator\Documents\IISExpress\config\aspnet.config
    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
    LOG: Post-policy reference: System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
    LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/433569cf/2e1bc57e/System.Web.Extensions.DLL.
    LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/433569cf/2e1bc57e/System.Web.Extensions/System.Web.Extensions.DLL.
    LOG: Attempting download of new URL file:///C:/Users/administrator/Documents/Visual Studio 2017/Projects/Rs/Rs.App/bin/System.Web.Extensions.DLL.
    LOG: Attempting download of new URL file:///C:/Users/administrator/Documents/Visual Studio 2017/Projects/Rs/Rs.App/bin/System.Web.Extensions/System.Web.Extensions.DLL.
    LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/433569cf/2e1bc57e/System.Web.Extensions.EXE.
    LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/433569cf/2e1bc57e/System.Web.Extensions/System.Web.Extensions.EXE.
    LOG: Attempting download of new URL file:///C:/Users/administrator/Documents/Visual Studio 2017/Projects/Rs/Rs.App/bin/System.Web.Extensions.EXE.
    LOG: Attempting download of new URL file:///C:/Users/administrator/Documents/Visual Studio 2017/Projects/Rs/Rs.App/bin/System.Web.Extensions/System.Web.Extensions.EXE.

    The 3.5 version of System.Web.Extensions is under C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5 ... but as you can see above that path was not being looked at.  Even the Reference properties file shows this path, but at runtime the app errors out with the above page, apparently not looking for the DLL in the right place.

    Eventually I figured out to set "copy local" to TRUE, which solved the problem by copying the DLL to the bin directory during compilation, and the bin directory is one of the above listed "attempting download" paths.  

    But I am wondering why the above "attempting download" paths do not include the path listed in the reference in the first place?  

    Thanks.  John

    Sunday, January 7, 2018 3:00 AM

All replies

  • User283571144 posted

    Hi JohnK44,

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

    According to your error message, I suggest you could firstly try to install the ASP.NET 2.0 AJAX 1.0 , which in turn installed the missing System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 in the GAC.

    Best Regards,

    Brando

    Monday, January 8, 2018 6:39 AM
  • User-18919477 posted

    Thanks, that worked!

    Now I do not have a System.Web.Extensions.dll file in my dev or deploy area or even in my reference list ... is this all covered in the .NET 2 framework now?

    Just curious, are there similar upgrades to .NET 2 that would eliminate the need to reference any of these?

    • System
    • System.configuration
    • System.Data
    • System.Data.DataSetExtensions
    • System.Drawing
    • System.EnterpriseServices
    • System.Web
    • System.Web.Services
    • System.Xml
    • System.Xml.Linq
    • WindowsBase

    Thanks.  John

    Monday, January 8, 2018 8:39 PM
  • User475983607 posted

    Installed the AJAX Tool Kit loads the assemblies in the GAC.

    Monday, January 8, 2018 8:47 PM
  • User-18919477 posted

    Yes, I think the GAC on my machine is in c:\Windows\assembly.  I see a DLL for System.Web.Extensions 1.061025.0 ... so I take it you are implying that if the DLL is in the GAC, then an explicit reference is not needed in the Project?

    However in this GAC directory there are also DLLs for all of the other references I just mentioned, that I have to declare in my Project or else I will get compilation errors.   Why is that?  Is there a cache somewhere that I can clear that will allow me to compile successfully without the need for all those explicit System* references?

    Thanks.  John

    Monday, January 8, 2018 8:58 PM
  • User475983607 posted

    JohnK44

    Yes, I think the GAC on my machine is in c:\Windows\assembly.  I see a DLL for System.Web.Extensions 1.061025.0 ... so I take it you are implying that if the DLL is in the GAC, then an explicit reference is not needed in the Project?

    Correct, if there is a dependent assembly in the GAC then the app will be able to grab shared assembly from the GAC otherwise it will look in the bin.

    JohnK44

    However in this GAC directory there are also DLLs for all of the other references I just mentioned, that I have to declare in my Project or else I will get compilation errors.   Why is that?  Is there a cache somewhere that I can clear that will allow me to compile successfully without the need for all those explicit System* references?

    The reference docs explain the GAC better than I can.

    https://docs.microsoft.com/en-us/dotnet/framework/app-domains/gac

    Monday, January 8, 2018 9:09 PM