none
Problem migrating asp .net 3.5 vs2010 solution to vs 2017 solution RRS feed

  • Question

  • I have installed both vs 2010 and vs 2017 on windows 7 32 bit.

    I was able to build the entire on vs 2017. 

    However, when running the application in debug mode, I get the error, below.  The 'ProjAppMod.XmlSerializers'  dll was generated ( via generate serializer assembly set on in project) by another project in the solution which builds ProjAppMod.dll.   I checked the version of all dlls and they are .net version v2.0.50727.  All the projects are .net version 3.5.  No issues when running on the same machine using vs 2010.   

    There is something else I found bizzare... if I rename ProjAppMod.XmlSerializers.dll to ProjAppMod.XmlSerializers.dll.src (in web application project which uses this dll) and do debug in vs 2017, it works.

    Any help is appeciated.  Thanks in advance.

      


    Could not load file or assembly 'ProjAppMod.XmlSerializers' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. 
    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 'ProjAppMod.XmlSerializers' 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 'ProjAppMod.XmlSerializers' could not be loaded.


    === Pre-bind state information ===
    LOG: User = dom\romang
    LOG: DisplayName = ProjAppMod.XmlSerializers
     (Partial)
    LOG: Appbase = file:///C:/Users/romang/Source/Repos/weba/ProjWebSvc/
    LOG: Initial PrivatePath = C:\Users\romang\Source\Repos\weba\ProjWebSvc\bin
    Calling assembly : (Unknown).
    ===
    LOG: This bind starts in default load context.
    LOG: Using application configuration file: C:\Users\romang\Source\Repos\weba\ProjWebSvc\web.config
    LOG: Using host configuration file: C:\Users\romang\Documents\IISExpress\config\aspnet.config
    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
    LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
    LOG: Attempting download of new URL file:///C:/Users/romang/AppData/Local/Temp/Temporary ASP.NET Files/ProjWebSvc/b25fb8bc/4f861caa/ProjAppMod.XmlSerializers.DLL.
    LOG: Attempting download of new URL file:///C:/Users/romang/AppData/Local/Temp/Temporary ASP.NET Files/ProjWebSvc/b25fb8bc/4f861caa/ProjAppMod.XmlSerializers/ProjAppMod.XmlSerializers.DLL.
    LOG: Attempting download of new URL file:///C:/Users/romang/Source/Repos/weba/ProjWebSvc/bin/ProjAppMod.XmlSerializers.DLL.
    ERR: Failed to complete setup of assembly (hr = 0x8013101b). Probing terminated.



    Stack Trace: 


    [BadImageFormatException: Could not load file or assembly 'ProjAppMod.XmlSerializers' 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 'ProjAppMod.XmlSerializers' 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.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp) +232
       System.Web.Compilation.BuildManager.CompileGlobalAsax() +51
       System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +337

    [HttpException (0x80004005): Could not load file or assembly 'ProjAppMod.XmlSerializers' 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 'ProjAppMod.XmlSerializers' 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) +9002803
       System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +85
       System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +333


    Friday, January 18, 2019 4:44 AM

All replies

  • The error is occurring because what you are building against is newer than what the ASP.NET runtime is using. For web applications you can change the target framework by using the project properties. It is important that all assemblies you rely on are not using a newer version than your main web app. However ASP.NET also does runtime compilation and that is a different setting altogether. Go into your web.config and check the <compilation> element's targetFramework attribute. It should match what your project file is compiling against. Also check the <httpRuntime> element's targetFramework property. It should match as well. (Note: the docs are old but should still be correct)

    For future ASP.NET questions please post in the ASP.NET forums.


    Michael Taylor http://www.michaeltaylorp3.net

    Friday, January 18, 2019 3:04 PM
  • Hi rgelfand,

    Thank you for posting here.

    Since this post is related to asp.net, please post it in the following forum.

    https://forums.asp.net/

    The Visual C# forum discuss and ask questions about the C# programming language, IDE, libraries, samples, and tools.

    Best regards,

    Jack 


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, January 21, 2019 5:14 AM