ASP.NET 编译器抱怨框架版本与 MiniProfiler 不匹配 [英] ASP.NET Compiler complaining of mismatching framework versions with MiniProfiler

查看:21
本文介绍了ASP.NET 编译器抱怨框架版本与 MiniProfiler 不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个从 VS2010 升级到 VS2012 的 MVC3 项目.该项目还引用了 MiniProfiler.我们的应用程序在 VS2012 中编译并运行良好,没有任何警告/错误.使用 IIS Express 运行时,两个程序集都可以正常加载.但是,在使用 ASP.NET 编译器工具时,我收到以下警告:

<块引用>

Microsoft (R) ASP.NET 编译工具版本 4.0.30319.17929 实用程序预编译 ASP.NET 应用程序 版权所有 (C) Microsoft公司.保留所有权利.

(0): 警告 : 以下程序集依赖于高于目标且可能无法加载的 .NET Framework在运行时正确导致失败:MiniProfiler,版本=2.1.0.0,文化=中性,PublicKeyToken=b44f9351044011a3.这依赖项是:System.Data.Linq,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089.您应该确保依赖程序集对于目标框架是正确的,或者确保您正在解决的目标框架是依赖的框架组装.

我们没有对 System.Data.Linq 的显式引用.直到更新到 VS2012,我们没有任何错误.MiniProfiler 版本确实针对 .NET 4.0(就像我们的应用程序一样).什么可能导致此警告?

解决方案

我终于能够通过 这个答案的提示修复它.我在 web.config 中添加了以下 行:

<预><代码><配置><system.web><编译调试="true" targetFramework="4.0"><组件><!-- 等等...--><add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/><!-- 等等...--></组件></编译><system.web></配置>

I have an MVC3 project that I upgraded from VS2010 to VS2012. The project also has a reference to MiniProfiler. Our application compiles and runs fine in VS2012 without any warnings/errors. Both assemblies load fine when running with IIS Express. When using the ASP.NET Compiler tool, however, I get the following warning:

Microsoft (R) ASP.NET Compilation Tool version 4.0.30319.17929 Utility to precompile an ASP.NET application Copyright (C) Microsoft Corporation. All rights reserved.

(0): warning : The following assembly has dependencies on a version of the .NET Framework that is higher than the target and might not load correctly during runtime causing a failure: MiniProfiler, Version=2.1.0.0, Culture=neutral, PublicKeyToken=b44f9351044011a3. The dependencies are: System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089. You should either ensure that the dependent assembly is correct for the target framework, or ensure that the target framework you are addressing is that of the dependent assembly.

We don't have an explicit reference to System.Data.Linq. Up until the update to VS2012, we didn't have any errors. The MiniProfiler version is indeed targeting .NET 4.0 (as is our application). What could be causing this warning?

解决方案

I was finally able to fix it with a tip from this answer. I added the following <add> line in the web.config:

<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <!-- etc... -->
        <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
        <!-- etc... -->
      </assemblies>
    </compilation>
  <system.web>
</configuration>

这篇关于ASP.NET 编译器抱怨框架版本与 MiniProfiler 不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆