Could not load file or assembly 'WebGrease' or one of its dependencies

前端 未结 9 1512
醉梦人生
醉梦人生 2020-12-14 00:04

When I run my MVC4 Web application it gives the following error:

Could not load file or assembly \'WebGrease\' or one of its dependencies. The located assemb         


        
相关标签:
9条回答
  • 2020-12-14 00:19

    My situation was this: worked fine on my dev machine but got this same "webgrease missing" error on the host platform. My solution:
    1. Removed all .dll's from the \bin directory
    2. Removed all of the references from web.config.
    3. As I refreshed the home page and got a "some-next.dll was missing" error, I copied that some-next.dll to the bin directory AND added the reference to web.config for each "fresh" dll

    Note: Look at the WebGrease.dll properties | details tab - make sure the product version matched the <dependentAssembly>. In my case, it was this:

    <dependentAssembly>
      <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
      <bindingRedirect oldVersion="0.0.0.0-1.5.1.25624" newVersion="1.6.5135.21930" />
    </dependentAssembly>
    
    0 讨论(0)
  • 2020-12-14 00:23

    I deleted "bin", "obj" folders for project and and solution "packages" folder, then it worked.

    0 讨论(0)
  • 2020-12-14 00:32

    I had the same issue.

    This was resolved by

    1) running the Package Manager Console

    2) in Console, type: 'Install-Package Microsoft.AspNet.Web.Optimization'

    which resolved all the incorrect dependencies.

    0 讨论(0)
  • 2020-12-14 00:33

    I had to run Update-Package -Reinstall Microsoft.AspNet.Web.Optimization

    That updated my web.config and all references

    0 讨论(0)
  • 2020-12-14 00:34

    Just delete the webgrease from packages folder or uninstall it using package console and then run Update-Package -Reinstall Microsoft.AspNet.Web.Optimization in package cone

    0 讨论(0)
  • 2020-12-14 00:36

    Just update WebGrease to 1.6

    PM> Update-Package WebGrease -Version 1.6
    
    0 讨论(0)
提交回复
热议问题