- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
这个问题有很多解决方案,请阅读下面的所有答案,它们也可能会帮助您解决问题。如果您找到解决此问题的新方法,请在您的答案中记录
我正在尝试将 System.Web.Optimization 添加到我的 ASP.NET Web 窗体解决方案中。我通过 NuGet 包添加了 Microsoft ASP.NET Web 优化框架。它在引用中添加了 Microsoft.Web.Infrastracture 和 WebGrease (1.5.2)。
但是,当我运行
<%= System.Web.Optimization.Scripts.Render("~/bundles/js")%>
运行时出错
Could not load file or assembly 'WebGrease, Version=1.5.1.25624, 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)
我已经尝试将 assemblyBinding 添加到 Web.Config
<runtime>
<legacyUnhandledExceptionPolicy enabled="1"/>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-1.5.1.25624" newVersion="1.5.2.14234"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
但没有任何运气。
我注意到我网站的 Web 配置包含这一行
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
如果我把它换成
<configuration>
然后一切正常,我没有收到运行时错误。不幸的是,我需要 xmlns。我的项目的其他组件依赖于它。
当架构指向 v2.0 时,为什么优化会尝试加载旧版本?有没有办法强制它加载最新的或唯一可用的 WebGrease.dll?
在不改变的情况下我还能尝试什么
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"> ?
感谢您提供的任何帮助!
编辑:1)附加FusionLog结果。也许会有帮助
=== Pre-bind state information ===
LOG: User = [USER]
LOG: DisplayName = WebGrease, Version=1.5.1.25624, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///C:/Projects/PROJECT_NAME/trunk/www.PROJECT_NAME.com/
LOG: Initial PrivatePath = C:\Projects\PROJECT_NAME\trunk\www.PROJECT_NAME.com\bin
Calling assembly : System.Web.Optimization, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Projects\PROJECT_NAME\trunk\www.PROJECT_NAME.com\web.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: WebGrease, Version=1.5.1.25624, Culture=neutral, PublicKeyToken=31bf3856ad364e35
2) 确认,问题在
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
但是,我不明白为什么
最佳答案
我在生产服务器上遇到了这个问题,而在开发者机器上一切正常。这些行帮助:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.0" newVersion="1.5.2.14234"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
关于c# - 无法加载文件或程序集 'WebGrease' 它的依赖项之一。找到的程序集的 list 定义与程序集引用不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20908895/
我的任务是开始使用 ASP.NET Bundling 而不是 RequestReduce。起初这似乎是一件容易的事,但后来我遇到了问题,当 minifieng CSS 文件时: (3017,287):
构建部署包时从 aspnet_compiler.exe 收到以下警告: ASPNETCOMPILER(0,0): Warning : The following assembly has depend
当我运行我的 MVC4 Web 应用程序时,出现以下错误: Could not load file or assembly 'WebGrease' or one of its dependencies
这个问题有很多解决方案,请阅读下面的所有答案,它们也可能会帮助您解决问题。如果您找到解决此问题的新方法,请在您的答案中记录 我正在尝试将 System.Web.Optimization 添加到我的 A
我正在尝试通过命令行使用WebGrease 1.6(还尝试了VS2013的开发人员命令提示符)。当我运行“wg options”时,出现以下错误(附有屏幕截图) 未处理的异常:System.IO.Fi
我已经通过 NuGet 安装了 Microsoft ASP.NET Web 优化框架 1.1.3。我相信它安装得很好。这是一个 .NET 4.0 Web 窗体项目。 当我尝试捆绑时出现错误。我在 Ap
首先,回答这个问题,不要解决我的错误: Upgrading WebGrease to version 1.3.0 gets me error 我的生产服务器上有以下绑定(bind)重定向:
将 WebGrease 升级到版本 1.3.0 时出现错误: Could not load file or assembly 'WebGrease, Version=1.0.0.0, Culture=
当我将名为 glyphicons.css 的特定 CSS 文件放入 BundleConfig 时,会发生以下错误 WebGrease.dll 中发生“System.IndexOutOfRangeExc
例如 System.Linq dogs.ToList().ForEach(dog => Console.WriteLine(dog.Name)); WebGrease.Css.Extensions d
我正在尝试将 bundle 添加到我的 Mvc4 网络元素中。我采取的步骤: 将对我的元素的引用添加到 System.Web.Optimization 已添加 @Styles.Render("~/Co
我有一个 MVC4 Web API 项目。运行服务项目时出现错误 Could not load file or assembly 'WebGrease, Version=1.5.1.25624, Cu
我数了一个问题,在我将WebGrease.dll从1.5.2升级到1.6.0,并部署到azure web role后,出现错误“Object reference not set to an insta
我是一名优秀的程序员,十分优秀!