none
This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded RRS feed

  • Question

  • So I'm getting this error:

    Error 37 'Could not load file or assembly 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Internals\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Internals.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.'

    The problem is that I'm not referencing or using this assembly in my project at all. I'm running into this problem as a result of converting the project over from VS 2005 to 2012.

    (It's a C# winforms project)

    • Moved by Amanda Zhu Thursday, June 13, 2013 2:00 AM move to a more appropriate forum
    • Moved by Sheng Jiang 蒋晟 Saturday, November 8, 2014 5:52 PM not winforms related
    Tuesday, June 11, 2013 4:02 PM

Answers

  • Well I'd rather lower them all to the lowest framework possible for compatibility's sake.

    I have a C++ Library (.DLL) project in the solution that I can't figure out how to change the target framework of though...

    If it's a C++/CLI project, you'll have to edit the framework directly in the .vcxproj file.  Search for "Framework" and you'll find the line where it's changed.

    Note that using a framework other than 4.5 will require having the appropriate older VC++ compiler installed on your system in addition to VS 2012.  See: http://stackoverflow.com/a/2921868/65358


    Reed Copsey, Jr. - http://reedcopsey.com
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    • Marked as answer by Barry Wang Wednesday, June 26, 2013 6:52 AM
    Tuesday, June 11, 2013 6:09 PM
    Moderator

All replies

  • Make sure all of your projects target the same version of the .NET Framework.

    It sounds like one or more of your projects was likely converted to .NET 4.5, but another is using 3.5 or earlier still.

    If you change them all to the same version (.NET 4.5, for example), then this error should go away.


    Reed Copsey, Jr. - http://reedcopsey.com
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    • Proposed as answer by ManuPolu Wednesday, October 1, 2014 6:22 AM
    Tuesday, June 11, 2013 4:16 PM
    Moderator
  • Well I'd rather lower them all to the lowest framework possible for compatibility's sake.

    I have a C++ Library (.DLL) project in the solution that I can't figure out how to change the target framework of though...

    Tuesday, June 11, 2013 5:31 PM
  • Well I'd rather lower them all to the lowest framework possible for compatibility's sake.

    I have a C++ Library (.DLL) project in the solution that I can't figure out how to change the target framework of though...

    If it's a C++/CLI project, you'll have to edit the framework directly in the .vcxproj file.  Search for "Framework" and you'll find the line where it's changed.

    Note that using a framework other than 4.5 will require having the appropriate older VC++ compiler installed on your system in addition to VS 2012.  See: http://stackoverflow.com/a/2921868/65358


    Reed Copsey, Jr. - http://reedcopsey.com
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    • Marked as answer by Barry Wang Wednesday, June 26, 2013 6:52 AM
    Tuesday, June 11, 2013 6:09 PM
    Moderator
  • Sorry but there isn't any such line in my project file.

    Heck, just searching for the term "frame" in Notepad gave me no results.

    Wednesday, June 26, 2013 3:16 PM
  • If you edit the .vcxproj file, there should be a section (in a C++/CLI app) like so:

      <PropertyGroup Label="Globals">
        <ProjectName>YourProject</ProjectName>
        <ProjectGuid>{00000000-6004-0000-0000-000023389665}</ProjectGuid>
        <RootNamespace>SomeNamespace</RootNamespace>
    
        <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
    
        <Keyword>MFCProj</Keyword>
      </PropertyGroup>
    

    You can always add the TargetFrameworkVersion to the "Globals" section as needed.


    Reed Copsey, Jr. - http://reedcopsey.com - If a post answers your question, please click Mark As Answer on that post. If you find a post helpful, please click Vote as Helpful.

    Wednesday, June 26, 2013 4:54 PM
    Moderator
  • Ahh! Mine only had the Guid property under globals and nothing else.

    I also tried re-converting from 2005 and it came in much cleaner this time.

    Except now I'm getting the problem that the second to last post here had: http://social.msdn.microsoft.com/Forums/vstudio/en-US/ccd259a9-aaa4-4341-b20f-16251038e9f5/lnk2034-error-metadata-inconsistent-with-coff-symbol-table

    I got the project's framework working but now I think I need the linker to agree with it. How might I do that?


    Edit: Okay I figured out I need to use the Windows7.1SDK as the target toolset according to this http://msdn.microsoft.com/en-us/library/vstudio/ff770576.aspx
    • Edited by Xenoninja Wednesday, June 26, 2013 6:47 PM Windows7.1SDK Found
    Wednesday, June 26, 2013 6:33 PM
  • Okay I been going around in circles but I finally got the SDK installed and selected as my Platform Toolset for the project

    but now I'm getting 

    Error 1 error MSB6006: "CL.exe" exited with code -1073741515. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.Cpp.Win32.targets

    From what I understand is that I need VS2008 installed on this system, but I can't find a link to download the express version :(

    Wednesday, June 26, 2013 9:52 PM

  • From what I understand is that I need VS2008 installed on this system, but I can't find a link to download the express version :(

    Try (for VS 2008): http://download.microsoft.com/download/8/B/5/8B5804AD-4990-40D0-A6AA-CE894CBBB3DC/VS2008ExpressENUX1397868.iso

    For Update 1: http://download.microsoft.com/download/E/8/E/E8EEB394-7F42-4963-A2D8-29559B738298/VS2008ExpressWithSP1ENUX1504728.iso


    Reed Copsey, Jr. - http://reedcopsey.com - If a post answers your question, please click Mark As Answer on that post. If you find a post helpful, please click Vote as Helpful.

    Wednesday, June 26, 2013 10:24 PM
    Moderator
  • Well I got them installed without a hitch. But nothing's changed. From what I understand CL.exe is failing because it's looking for another exe that should be somewhere and can't find it. My other hint is that I'm running on a 64-bit Windows 7 system that might have installed the SDK and VS2008 somewhere else, so simply installing them isn't helping much.

    I guess I just need to figure out which files it's looking for and where they need to be...

    Thursday, June 27, 2013 4:01 PM
  • Just a clarify statement that I ran into regarding this problem.  I had this same problem, and (foolishly) was struggling to find out what assembly was causing the problem.  Under the references for the offending project, you can click on each one and review the "Runtime Version" using the properties section for each assembly.  Once I realized that, I could find the problem assembly and go from there.

    Again, this is probably a no sh*t time post for 99% of the viewers of this post, but it frustrated me for a while chasing the wrong rabbit.

    Monday, September 16, 2013 3:15 PM