How to resolve: System.IO.FileLoadException when loading WebGrease assembly

sis2023 0 Reputation points
2023-06-15T15:09:50.58+00:00

I'm encountering the following error message when trying to load the WebGrease assembly: "System.IO.FileLoadException: Could not load file or assembly 'WebGrease, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference."

Untitled2023

Developer technologies .NET Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,471 Reputation points Microsoft External Staff
    2023-06-16T02:27:34.9266667+00:00

    Hi @sis2023 ,

    This is caused by a reference to WebGrease in the web.config file.

    This can be caused by a number of different reasons.

    1. Incorrect assembly loaded

    1. Version mismatch between NuGet and Assembly
    2. Incorrect assembly referenced

    Please visit below links.

    #Troubleshooting NuGet references

    http://developers.de/blogs/damir_dobric/archive/2014/08/26/troubleshooting-nuget-references.aspx

    #Could not load file or assembly… NuGet Assembly Redirects

    http://blog.myget.org/post/2014/11/27/Could-not-load-file-or-assembly-NuGet-Assembly-Redirects.aspx

    #WebGrease Nuget

    https://www.nuget.org/packages/WebGrease/1.0.0

    You can also refer to the similar issue with yours

    https://stackoverflow.com/questions/19585729/could-not-load-file-or-assembly-xxx-or-one-of-its-dependencies-the-located-asse


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.