Could not load file or assembly System.Threading.Tasks

Could not load file or assembly System.Threading.Tasks

Old forum URL: forums.lhotka.net/forums/t/11927.aspx


mayurimalgave posted on Tuesday, April 09, 2013

Hiii,

I have created an application using CSLA & silverlight.

I have used recent new dll from CSLA4.5 20

I am getting the following error at the statement:

DataPortal.BeginFetch<CompanyList>(callback);

in Library project.

 

Error - Could not load file or assembly 'System.Threading.Tasks, Version=2.5.16.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

Any suggestions?

BenBoneyIII replied on Tuesday, April 16, 2013

mayurimalgave,

I had this same problem with an WPF/CSLA app after upgrading to CSLA 4.5.22.  I think it has to do with Microsoft.BCL.Async.  System.Runtime and System.Threading.Tasks are referenced in my WPF project.  These references were added via Nuget when I upgraded CSLA from 2.5.10 to 2.5.22.  However, in my case, ClickOnce does not recognize these assemblies as required files.  So, the files were never pushed to the end user.  This seems to be an issue with .NET 4 only, not 4.5.

My solution was to manually add those 2 dll's to the root of my project as Content.  This forced ClickOnce to publish the files and then my app was happy.  Perhaps your installation to the WCF "server" does not include these files?

 

Hope this helps

Ben


mayurimalgave replied on Friday, April 19, 2013

Thanks Ben.

But

I solved this problem by doing following steps.

1.Open Visual Studio.

2.Go to Tools -> Library Package Manager -> Package Manager console.

3.Run the following command:

PM>Install-Package Microsoft.Bcl.Async

For reference,follow a link: http://nuget.org/packages/Microsoft.Bcl.Async/

QOfLight replied on Tuesday, April 16, 2013

I am also getting this, so if you solve, please let me know.

This is what I have tracked down thus far. Silverlight 5 Tools or SDK installs a different version of mscorlib which is 5.xxxxx, and there is another version 4.xxxxx which this project seems to have been compiled with. General rule is the most recent is used. I deinstalled silverlight 4 just in case.

I am trying to specify an assembly version for mscorlib in the web.config (either the one with CSLA or this newer one) but that did not fix it either.

It seems to me that something older (which could have been compiled to target a specific version is somehow loading the old 2.x mscorlib/ Threading which of course doesn't have .Tasks. If I get desperate I will have to install something that says who loaded which assembly.

Rocky ?

Thanks,

Mary

mayurimalgave replied on Friday, April 19, 2013

 hi QOfLight,

I solved this problem by doing following steps.

1.Open Visual Studio.

2.Go to Tools -> Library Package Manager -> Package Manager console.

3.Run the following command:

PM>Install-Package Microsoft.Bcl.Async

For reference,follow a link: http://nuget.org/packages/Microsoft.Bcl.Async/

 

Copyright (c) Marimer LLC