Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.
Could not load file or assembly 'System.Activities, Version=4.0.0.0

Locked Could not load file or assembly 'System.Activities, Version=4.0.0.0

  • יום רביעי 29 יוני 2011 04:59
     
      קוד כלול

    Hi,

    When i am trying to create a web application(either website or wcf service project or any web related projects) using visual studio. I got the error as below and i am not able to continue to work. But for wpf applications and desktop applications i am not getting errors like this

    Could not load file or assembly 'System.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Index not found. (Exception from HRESULT: 0x80131124)

    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 'System.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Index not found. (Exception from HRESULT: 0x80131124)

    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.


    Stack Trace: 

     

    [BadImageFormatException: Could not load file or assembly 'System.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Index not found. (Exception from HRESULT: 0x80131124)]
      System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
      System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +39
      System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks) +132
      System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +144
      System.Reflection.Assembly.Load(String assemblyString) +28
      System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46
    
    [ConfigurationErrorsException: Could not load file or assembly 'System.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Index not found. (Exception from HRESULT: 0x80131124)]
      System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +618
      System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +57
      System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +178
      System.Web.Compilation.WebDirectoryBatchCompiler..ctor(VirtualDirectory vdir) +122
      System.Web.Compilation.BuildManager.BatchCompileWebDirectoryInternal(VirtualDirectory vdir, Boolean ignoreErrors) +53
      System.Web.Compilation.BuildManager.BatchCompileWebDirectory(VirtualDirectory vdir, VirtualPath virtualDir, Boolean ignoreErrors) +187
      System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) +92
      System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) +320
      System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) +111
      System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean ensureIsUpToDate) +90
      System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath) +15
      System.Web.UI.WebServiceParser.GetCompiledType(String inputFile, HttpContext context) +43
      System.Web.Services.Protocols.WebServiceHandlerFactory.GetCompiledType(String url, HttpContext context) +35
      System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath) +180
      System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated) +47
      System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +203
      System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +128
      System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184

כל התגובות

  • יום שישי 01 יולי 2011 09:22
     
     
  • יום שישי 04 מאי 2012 05:28
     
     

    I too had this issue after two days of hair pulling, i noticed that the system.activities dll had a modified date which was close to the time/date from which i got this error and around that time we had a power outage, so i copied the same dll from another machine and pasted it there and it worked like a charm. For those who are interested the problematic dll is located in C:\WINDOWS\Microsoft.NET\assembly\GAC_MSIL\System.Activities\v4.0_4.0.0.0__31bf3856ad364e35 i dont know if whoever reads this has the same root cause as me......but its worth a try.

    Regards

    Prasanth