30

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?

TheCloudlessSky
  • 18,608
  • 15
  • 75
  • 116
  • I've had a look at the setups, and I can't see anything obviously wrong that might cause this... – Marc Gravell Apr 17 '13 at 11:24
  • @MarcGravell - So what's really weird is that if I create a new project and use the same approach above, it'll work just fine... :( – TheCloudlessSky Apr 17 '13 at 17:55
  • Could check the bin directories for any funky dll's that could have ended up there? Also backup your obj folder then delete it from the project I find that helps with all kinds of oddities ;o) – Luke Baughan Apr 18 '13 at 19:23
  • @bUKaneer - It wouldn't be the obj folder since we run the `aspnet_compiler` outside of that directory structure. I also checked the pre-compiled bin folder and can't find anything odd.. :( – TheCloudlessSky Apr 22 '13 at 18:45
  • 1
    I seem to be having this same problem with a different pre-compiled project. All the assemblies are on .Net 4, but it complains about a mismatch of versions. – AJ Henderson May 30 '13 at 14:18

2 Answers2

30

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>
Community
  • 1
  • 1
TheCloudlessSky
  • 18,608
  • 15
  • 75
  • 116
3

Did you changed targetFramework inside Web.confing?

Andrei
  • 42,814
  • 35
  • 154
  • 218