升级到1.3.0版本只会导致生产服务器出现错误



首先,回答这个问题,不要解决我的错误:

升级到1.3.0版本会出现错误

我在生产服务器上有如下的bindingredirect:

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

我在我的生产服务器上有以下DLL,这是Microsoft ASP所需的。. NET Web优化框架:

  1. System.Web.Optimization.dll 1.0.0.0(这不是预发布版本)
  2. Antlr3.Runtime.dll 3.3.1.7705
  3. Webgrease.dll 1.3.0.0

我得到以下错误:

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)

我检查了GAC,我已经删除了所有临时ASP。. NET文件夹,我已经尝试从我的配置<bindingRedirect>中删除newVersion属性。我不确定什么是告诉ASP。. NET查找web润滑脂1.0

终于弄明白了为什么这对我不起作用,尽管其他用户说这对他们很有效。

我的web中有以下绑定重定向。配置文件强制System.Web.Optimization程序集使用较新的版本:

<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>

就像其他用户一样,但它不起作用。然后,我使用融合日志查看器(Fuslogvw.exe)查看更多信息,发现绑定过程甚至没有查看重定向指令。

最终发现根... .上必须有而不是 XML名称空间如果我从<configuration>元素中删除以下内容,它可以工作:xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"

还要确保在<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">元素上指定了以下XML名称空间。

最后! !

我遇到了同样的问题。我有一个解决方案与不同的项目。我已经从所有项目中卸载了microt.aspnet . web . optimization和WebGrease,并手动删除了所有bin和obj文件夹。

然后我只在需要这个包的项目中安装了microt.aspnet.web . optimization。

此时我已经删除了packages文件夹中的所有文件。

当我再次打开Visual Studio时,它已经开始从头安装所有的包。

最后我做了一个git-diff,结果如下:

$ 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>..packagesWebGrease.1.5.2lib</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>..packagesWebGrease.1.3.0libAntlr3.Runtime.dll</HintPath>
+    <Reference Include="Antlr3.Runtime">
+      <HintPath>..packagesAntlr.3.4.1.9004libAntlr3.Runtime.dll</HintPath>
     </Reference>
     <Reference Include="Kendo.Mvc">
       <HintPath>..DllkendoKendo.Mvc.dll</HintPath>
@@ -84,9 +85,8 @@
       <Private>True</Private>
       <HintPath>..packagesMicrosoft.AspNet.Mvc.4.0.30506.0libnet40System.Web.Mvc.dll</HintPath>
     </Reference>
-    <Reference Include="System.Web.Optimization, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, pr
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..packagesMicrosoft.AspNet.Web.Optimization.1.1.0libnet40System.Web.Optimization.dll</HintPath>
+    <Reference Include="System.Web.Optimization">
+      <HintPath>..packagesMicrosoft.AspNet.Web.Optimization.1.1.2libnet40System.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>..packagesMicrosoft.Net.Http.2.0.20710.0libnet40System.Net.Http.WebRequest.dll</HintPath>
     </Reference>
-    <Reference Include="WebGrease, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchite
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..packagesWebGrease.1.3.0libWebGrease.dll</HintPath>
+    <Reference Include="WebGrease">
+      <HintPath>..packagesWebGrease.1.5.2libWebGrease.dll</HintPath>
     </Reference>
   </ItemGroup>
   <ItemGroup>
@@ -760,7 +759,6 @@
     <Content Include="ViewsHomeIndex.cshtml" />
     <Content Include="ViewsSharedError.cshtml" />
     <Content Include="ViewsShared_LoginPartial.cshtml" />
-    <Content Include="ViewsShared_Layout.cshtml" />
     <Content Include="ViewsWeb.config" />
   </ItemGroup>
   <ItemGroup>
@@ -800,6 +798,7 @@
       <Generator>RazorGenerator</Generator>
       <LastGenOutput>index1.generated.cs</LastGenOutput>
     </Content>
+    <Content Include="ViewsShared_Layout.cshtml" />
   </ItemGroup>
   <PropertyGroup>
     <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>

特别是App.config和Web. config。Config有以下不同:

       <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>

相关内容

  • 没有找到相关文章

最新更新