Upgrading WebGrease to version 1.3.0 causes an error only on the production server

Firstly, the answers to this question DO NOT solve my mistake:

Updating WebGrease to version 1.3.0 gives me an error

I have the following bindredirect on my server:

<dependentAssembly> <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" /> </dependentAssembly> 

I have the following DLLs on my production server that are required for the Microsoft ASP.NET Web Optimization Framework:

  • System.Web.Optimization.dll 1.0.0.0 (This is NOT a preliminary version)
  • Antlr3.Runtime.dll 3.3.1.7705
  • Webgrease.dll 1.3.0.0

I get the following 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 manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I checked the GAC, I deleted all the ASP.NET temporary folders, I tried to remove the newVersion attribute from my <bindingRedirect> configuration. I'm not sure what ASP.NET says for finding WebGrease 1.0

+4
asp.net-mvc-4 webgrease
May 31 '13 at 10:01
source share
2 answers

Finally it turned out why this does not work for me, despite the fact that other users say that it works for them.

I had the following binding redirection in the web.config file so that instead of building System.Web.Optimization use a newer version:

 <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" /> </dependentAssembly> </assemblyBinding> </runtime> </configuration> 

It was the same as other users, but it did not work. Then I used the merge log viewer (Fuslogvw.exe) to find out more information and found that the binding process did not even look at the redirection instruction.

Finally it turned out that there should not be an XML namespace at the root .... If I remove the following from my <configuration> element, it will work: xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"

Also, just make sure that you have the following XML namespace specified in the <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> .

Finally!!

+8
Jun 12 '13 at 5:10
source share

I have the same problem. I have a solution with various projects inside. I deleted Microsoft.AspNet.Web.Optimization and WebGrease from all projects and manually deleted all bin and obj folders.

Then I installed Microsoft.AspNet.Web.Optimization only in the project that needs this package.

At this point, I deleted all the files from the package folder.

When I opened Visual Studio again, it started reinstalling all packages from scratch.

In the end, I did git-diff, and this was the result:

 $ git diff App.config diff --git a/App.config index ceec0aa..8937482 100644 --- a/App.config +++ b/App.config @@ -18,7 +18,7 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" /> + <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> </dependentAssembly> </assemblyBinding> </runtime> $ git diff Web.config diff --git a/Web.config b/Web.config index 7287953..f196254 100644 --- a/Web.config +++ b/Web.config @@ -106,7 +106,7 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" /> + <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> </dependentAssembly> </assemblyBinding> </runtime> $ git diff myproj.csproj diff --git a/myproj.csproj b/myproj.csproj index 12987d0..a214bf7 100644 --- a/myproj.csproj +++ b/myproj.csproj @@ -24,6 +24,7 @@ </SccAuxPath> <SccProvider> </SccProvider> + <WebGreaseLibPath>..\packages\WebGrease.1.5.2\lib</WebGreaseLibPath> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> @@ -47,8 +48,8 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> - <Reference Include="Antlr3.Runtime, Version=3.3.1.7705, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processo - <HintPath>..\packages\WebGrease.1.3.0\lib\Antlr3.Runtime.dll</HintPath> + <Reference Include="Antlr3.Runtime"> + <HintPath>..\packages\Antlr.3.4.1.9004\lib\Antlr3.Runtime.dll</HintPath> </Reference> <Reference Include="Kendo.Mvc"> <HintPath>..\Dll\kendo\Kendo.Mvc.dll</HintPath> @@ -84,9 +85,8 @@ <Private>True</Private> <HintPath>..\packages\Microsoft.AspNet.Mvc.4.0.30506.0\lib\net40\System.Web.Mvc.dll</HintPath> </Reference> - <Reference Include="System.Web.Optimization, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, pr - <SpecificVersion>False</SpecificVersion> - <HintPath>..\packages\Microsoft.AspNet.Web.Optimization.1.1.0\lib\net40\System.Web.Optimization.dll</HintPath> + <Reference Include="System.Web.Optimization"> + <HintPath>..\packages\Microsoft.AspNet.Web.Optimization.1.1.2\lib\net40\System.Web.Optimization.dll</HintPath> </Reference> <Reference Include="System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processor <Private>True</Private> @@ -129,9 +129,8 @@ <Private>True</Private> <HintPath>..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.WebRequest.dll</HintPath> </Reference> - <Reference Include="WebGrease, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchite - <SpecificVersion>False</SpecificVersion> - <HintPath>..\packages\WebGrease.1.3.0\lib\WebGrease.dll</HintPath> + <Reference Include="WebGrease"> + <HintPath>..\packages\WebGrease.1.5.2\lib\WebGrease.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> @@ -760,7 +759,6 @@ <Content Include="Views\Home\Index.cshtml" /> <Content Include="Views\Shared\Error.cshtml" /> <Content Include="Views\Shared\_LoginPartial.cshtml" /> - <Content Include="Views\Shared\_Layout.cshtml" /> <Content Include="Views\Web.config" /> </ItemGroup> <ItemGroup> @@ -800,6 +798,7 @@ <Generator>RazorGenerator</Generator> <LastGenOutput>index1.generated.cs</LastGenOutput> </Content> + <Content Include="Views\Shared\_Layout.cshtml" /> </ItemGroup> <PropertyGroup> <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion> 

In particular, both App.config and Web.config had the following differences:

  <dependentAssembly> <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" /> + <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> </dependentAssembly> </assemblyBinding> 
+3
Nov 19 '13 at 11:28
source share



All Articles