I have a VB.NET application that's crashing with the following error:
System.IO.FileNotFoundException: Could not load file or assembly 'System.Threading.Tasks, Version=2.5.19.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Threading.Tasks, Version=2.5.19.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
I'm trying to use the Microsoft.Bcl.Async library. I've installed it via Nuget on the project that actually uses Async/Await calls and the project that references it. Everything works perfectly on my computer, but when I publish and test on another computer, my program crashes when I try to use the portion of it that's using Async/Await.
System.Threading.Tasks is referenced in both projects with Copy Local set to true. Microsoft.Threading.Tasks is referenced in both projects with Copy Local set to true. I've seen the other thread about this and it's installed in the relevant projects. These are the lines contained in my app.config file:
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.5.19.0" newVersion="2.5.19.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.5.19.0" newVersion="2.5.19.0" />
</dependentAssembly>
What am I missing with setting this up? Please let me know if you need more info. Thank you!
I found a workaround posted on the project site:
http://blogs.msdn.com/b/bclteam/p/asynctargetingpackkb.aspx
Resolution
This occurs because ClickOnce fails to deploy certain required assemblies. As a workaround, do the following:
1.Right-click on the project and choose Add Existing Item
2.Browse to the Microsoft.Bcl net40 package folder
3.In the File name text box enter .
4.Holding CTRL, select System.Runtime.dll and System.Threading.Tasks.dll
5.Click the down-arrow next to the Add button and choose Add as Link
6.In Solution Explorer, holding CTRL select System.Runtime.dll and System.Threading.Taks.dll
7.Right-click the selection, choose Properties and change Copy to Output Directory to Copy always
8.Republish
Click once will only include 3 main DLL's Microsoft.Threading.Tasks.dll
, Microsoft.Threading.Tasks.Extensions.dll
, and Microsoft.Threading.Tasks.Extensions.Desktop.dll
However, there are some more DLL's that are two more dependencies that are added when you add the nuget package that are not included in the distributable System.Runtime.dll
and System.Threading.Tasks.dll
You can see that the Path
property for those two refrences are inside your project, not in the normal location.
I am not entirely sure how to fix it, but at least now you know what the problem is.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With