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

    Question

  • Hi,

    I get the following error when trying to load/run my new web site...

    Created using...
    VS2010 Pro
    Vista 64bit
    .NET 4.0
    C#

    ----------------------------------------------------------------------------

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.BadImageFormatException: Could not load file or assembly 'Suma2' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Assembly Load Trace: The following information can be helpful to determine why the assembly 'Suma2' could not be loaded.

    WRN: Assembly binding logging is turned OFF.
    To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
    Note: There is some performance penalty associated with assembly bind failure logging.
    To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
    

    Stack Trace:

    [BadImageFormatException: Could not load file or assembly 'Suma2' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.]
      System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
      System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +43
      System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +127
      System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +142
      System.Reflection.Assembly.Load(String assemblyString) +28
      System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46
    
    [ConfigurationErrorsException: Could not load file or assembly 'Suma2' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.]
      System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +613
      System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +203
      System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +105
      System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +178
      System.Web.Compilation.BuildProvidersCompiler..ctor(VirtualPath configPath, Boolean supportLocalization, String outputAssemblyName) +54
      System.Web.Compilation.CodeDirectoryCompiler.GetCodeDirectoryAssembly(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories, Boolean isDirectoryAllowed) +600
      System.Web.Compilation.BuildManager.CompileCodeDirectory(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories) +128
      System.Web.Compilation.BuildManager.CompileResourcesDirectory() +31
      System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +304
    
    [HttpException (0x80004005): Could not load file or assembly 'Suma2' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.]
      System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +58
      System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +512
      System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters) +729
    
    [HttpException (0x80004005): Could not load file or assembly 'Suma2' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.]
      System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8893823
      System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +85
      System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +259
    


    Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.4028

    ----------------------------------------------------------------------------------

    I am thinking that the werver does NOT have .NET 4.0 installed.  If not what the heck did I do wrong or miss?

    Server Error in '/Suma' Application.

    Could not load file or assembly 'Suma2' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

     


    SquireDude
    Tuesday, November 02, 2010 4:04 PM

Answers

  • hi you have built your website with .net version 4.0 , but the installed framework is .net 2.as you mentioned, the server says: Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.4028 so either you have to build your website under .net 2, or upgrade your server framework to .net 4.0. hope this helps
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. Regards, Alireza
    • Marked as answer by SquireDude Tuesday, November 02, 2010 4:50 PM
    Tuesday, November 02, 2010 4:40 PM

All replies

  • hi you have built your website with .net version 4.0 , but the installed framework is .net 2.as you mentioned, the server says: Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.4028 so either you have to build your website under .net 2, or upgrade your server framework to .net 4.0. hope this helps
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. Regards, Alireza
    • Marked as answer by SquireDude Tuesday, November 02, 2010 4:50 PM
    Tuesday, November 02, 2010 4:40 PM
  • Alireze,

    Thanks you have confirmed what I thought.

    Thanks


    SquireDude
    Tuesday, November 02, 2010 4:51 PM