Could not load file or assembly 'WebGrease' one of its dependencies. The located assembly's manifest definition does not match the assembly reference

前端 未结 8 1513
终归单人心
终归单人心 2021-01-03 22:52

This issue has many solutions, please read all answers below, they might help you solve your problem too. If you find a new way to solve this, please document in you

相关标签:
8条回答
  • 2021-01-03 22:56

    I met this issue on a prod server, while everything worked fine on developer machine. These lines helped:

    <configuration>
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-1.5.2.0" newVersion="1.5.2.14234"/>
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
    </configuration>
    
    0 讨论(0)
  • 2021-01-03 23:01

    I modified my web.config file so that the newVersion="1.0.0.0" matched my Referenced file version:

    <dependentAssembly>
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-1.3.0.0" newVersion="1.0.0.0" />
      </dependentAssembly>
    
    0 讨论(0)
  • 2021-01-03 23:06

    met the same issue in web forms site .net 4.5 simple update nuget packages to last version helped me.

    0 讨论(0)
  • 2021-01-03 23:08

    I had this same issue but it was the result of copying a solution from my local development computer to a networked drive where we store our projects. I was unable to get the reference to work properly when I opened the solution from a mapped drive and I kept receiving this error. Only temporary workaround I found for my specific issue was to open the solution from its UNC path and not the mapped drive letter.

    0 讨论(0)
  • 2021-01-03 23:14

    In my case, the problem turned out to be an XML Processing Instruction (PI) (<?blah ... ?>) in my web.config file. Perfectly legal XML! but it caused this error message to show up and had me looking in all the wrong places.

    My web.config looked similar to the following - note the XML PI in the connectionStrings section:

    <configuration>
        ...
        <connectionStrings>
            <?blah ... ?>
            <add name="AppDb" ... />
        ...
        </connectionStrings>
        ...
        <runtime>
            <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
                ...
                <dependentAssembly>
                    <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
                    <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
                </dependentAssembly>
                ...
            </assemblyBinding>
        </runtime>
        ...
    </configuration>
    

    Note that the XML PI <?blah ... ?> was in the connectionStrings section -- that is, nowhere near the assemblyBinding section, or the bindingRedirect entries for WebGrease etc (which were correct!).

    0 讨论(0)
  • 2021-01-03 23:19

    Finally, the issue was in <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">. It caused the Render method to load wrong WebGrease assembly.

    Removing the xmlns solved the issue for me.

    0 讨论(0)
提交回复
热议问题