0

I have a project with assembly which refers to System.Threading.Tasks.Extensions, Version=4.6.28619, It's an old ASP.NET App hosted on IIS. After compilation, the app is running and everything is OK. After some time, the app throws an exception.

"System.Exception: Could not load file or assembly 'System.Threading.Tasks.Extensions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51.

After the recompilation and restarting the APP, everything works fine, but after a few hours, the exception is thrown again. What could be the problem?

I have tried to change web.config to use System.Threading.Tasks.Extensions in the correct version, but it didn't help.

Shawn Hemelstrand
  • 2,676
  • 4
  • 17
  • 30
Marcin
  • 1

1 Answers1

0

Version=4.6.28619 is file version, not the Assembly Version. I did goodle on System.Threading.Tasks.Extensions history.

I found the 4.3.0 should be the correct version in your project.

enter image description here

Other version couldn't find 4.1.0.0 version dll like picture above. Package version >=4.4.0, using 4.1.1.0. <4.3.0, using 4.0.0.0.

Now you can follow the suggestions below to check the issue

  1. Find the package System.Threading.Tasks.Extensions like my first picture.

  2. If you have multi project, make sure all the projects using the same version package.

  3. Delete the .vs folder

  4. Check the web.confg/app.config file, and check the version of System.Threading.Tasks.Extensions, if there are duplicates, please delete them.

  5. If the steps above not works for you, maybe the issue related to deployment. You can try the binding redirects.

Jason Pan
  • 15,263
  • 1
  • 14
  • 29