Upgrading WebGrease to version 1.3.0 gets me error

2019-01-30 23:26发布

While upgrading WebGrease to version 1.3.0 gets me error:

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. (Exception from HRESULT: 0x80131040)

Source Error:

Line 6:      <title>@ViewBag.Title</title>
Line 7:      @Styles.Render("~/Content/bundles/bootstrap")

How to resolve this error.

14条回答
叛逆
2楼-- · 2019-01-31 00:18

In my case all this methods didn't work. Finally I resolve this problem by uninstalling Microsoft.AspNet.Web.Optimization and WebGrease Packages via Package Manager, then I open my project file (.csproj) in notepad and delete all entries related to this two Packages, turn outs that there was problem. Finally I install this two packages via package manager again and run project. All work's fine now.

查看更多
闹够了就滚
3楼-- · 2019-01-31 00:20

I had a similar issue except it wasn't an error but a warning. After updating WebGrease to 1.3.0, a build put the warning source on the declaration. After ensuring that I had the appropriate assembly redirect in my web.config file, I eventually created a new _Layout.cshtml view and saved over the old file with the exact same razor markup as was in the previous (copy/paste). After that, the warning went away.

I'm not exactly sure what the warning was all about but try copying your code in your file, pasting it into a new file and overwriting the original.

If anyone has any insight as to why this works, I'm all ears.

查看更多
登录 后发表回答