Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
517 views
in Technique[技术] by (71.8m points)

.net - ASP.NET Compiler complaining of mismatching framework versions with MiniProfiler

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...