Unable to load file or Assembly 'Webgrease, Version=1.3.0.0, Culture=neutral

Asked

Viewed 17,227 times

4

I am just opening a new project based on MVC 5, framework 4.0, c#, and after opening the project for the first time and compiling, error occurs

Não foi possível carregar arquivo ou assembly 'WebGrease, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' ou uma de suas dependências. A definição do manifesto do assembly localizado não corresponde à referência do assembly. (Exceção de HRESULT: 0x80131040)

Any new project I create does not compile and accuses this error in the browser. I have not installed any components.

In my web.config is like this:

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=301880
  -->
<configuration>
  <configSections>
        <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    </configSections>
  <connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\aspnet-WebApplication1-20150730092912.mdf;Initial Catalog=aspnet-WebApplication1-20150730092912;Integrated Security=True"
      providerName="System.Data.SqlClient" />
  </connectionStrings>
  <appSettings>
    <add key="webpages:Version" value="3.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
  </appSettings>
  <system.web>
    <authentication mode="None" />
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
  </system.web>
  <system.webServer>
    <modules>
      <remove name="FormsAuthentication" />
    </modules>
  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-5.2.2.0" newVersion="5.2.2.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>
  • Tried to take out the last <dependentAssembly> of configuration?

  • I already went through this error and I realized that DLL was being referenced wrong on Web.Conf.

  • I updated this webgrease to version 1.5 and it keeps going wrong. Now from Owin

  • If you haven’t installed anything, why do you have this reference in webconfig? Take it out. If you upgraded, you must have installed.

  • The webgrase appears in the creation of a new project, and also appears in the references

  • Alone it does not appear. Did what I said? What is the result?

  • I did, and I removed the references. When creating the new project I was already bringing some references that I was not supposed to bring. the error continues.

  • What is OWIN’s mistake?

  • Could not load file or Assembly 'Microsoft.Owin, Version=2.1.0.0, Culture=neutral, Publickeytoken=31bf3856ad364e35' or one of its dependencies. The definition of the localized Assembly manifest does not correspond to the Assembly reference. (HRESULT exception: 0x80131040)

  • And you tried to update it too?

  • Yes I removed it from the references and installed again.

  • I solved!!! The solution was to go in Import and Export Settings, and give a Reset all Settings

Show 7 more comments

2 answers

3


I solved!!! The solution was to go in Import and Export Settings, and give a Reset all Settings

2

Reinstall Webgrease with a more current version. Open the Package Manager Console (View > Other Windows > Package Manager Console) and use the following command:

Update-Package WebGrease

This version 1.3.0.0 is very old. It must be from the times of MVC4.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.