Could not load file or assembly 'WebGrease, Version=1.5.1.25624, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies

前端 未结 18 2195
夕颜
夕颜 2021-01-31 07:02

I have an MVC4 Web API project. While running the service project I am getting an error

Could not load file or assembly \'WebGrease, Version=1.5.1.25624,

18条回答
  •  灰色年华
    2021-01-31 07:36

    Alreasy resolved this error. Situation was simpler than i thought. When you install from nuget new version of System.Web.Optimization it has reference to

    // References: WebGrease, Version=1.5.1.25624, Culture=neutral, PublicKeyToken=31bf3856ad364e35

    At same time i have WebGrease version 1.5.2.14234. Running project, we have this error: Could not load file or assembly 'WebGrease, Version=1.5.1.25624

    Soo, i try to check this version on nuget and was surprized, that it wasn't...but when i create new project with VS - i got it. To hack this error i try to install it in GAC..but gac says me, that this lib is not subscribed. Downgrading to System.Web.Optimization Version=1.1.0.0 , where reference is:

    // References: WebGrease, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

    and 1.3.0.0 is strongly subscribed - helped me. It works. After upgrading webgrease, i have it Version=1.6.5135.21930 and it worked perfectly.

    At conclusion, i have an opinion, than this error (Could not load file or assembly 'WebGrease, Version=1.5.1.25624) was because of that System.Web.Optimization lib is referenced to unsubscribed webgrease dll version.

提交回复
热议问题