Project using PCL 'TPL Dataflow' won't compile when setting .NET 4.5.2
I am using Windows 7 Pro x64 SP1 and Visual Studio 2012 Update 4. I cannot compile VB.NET WPF project when using TPL Dataflow package and .NET 4.5.2. I created a basic project with nothing but this code, and I compile for x64 only:
Imports System.Threading.Tasks.Dataflow
Class MainWindow
Dim test As New System.Threading.Tasks.Dataflow.BufferBlock(Of String)
End Class
I tried adding a facade reference to System.Runtime.dll and System.Diagnostics.Tracing.dll with no effect. It compiles fine if I upgrade to .NET 4.5. I must have a link to 4.5.2 because of other features to be in a project that requires it.
Specific errors:
Warning 1 The primary reference "System.Threading.Tasks.Dataflow, Version = 4.5.23.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a, processorArchitecture = MSIL" cannot be resolved because it has an indirect dependency on the assembly of the "System.Runtime, Version = 4.0.10.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a "which cannot be resolved in the current target environment. ".NETFramework, Version = v4.5.2". To resolve this issue, remove the reference "System.Threading.Tasks.Dataflow, Version = 4.5.23.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a, processorArchitecture = MSIL" or reconfigure your application to a version of the framework that contains "System.Runtime, Version = 4.0.10.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a ". TPLDataflow4.5.2Demo
Warning 2 The primary reference "System.Threading.Tasks.Dataflow, Version = 4.5.23.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a, processorArchitecture = MSIL" cannot be resolved because it has an indirect dependency on the assembly of the "System.Diagnostics.Tracing , Version = 4.0.10.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a ", which cannot be resolved in the target environment. ".NETFramework, Version = v4.5.2". To resolve this issue, remove the reference "System.Threading.Tasks.Dataflow, Version = 4.5.23.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a, processorArchitecture = MSIL" or migrate your application to a framework version that contains "System.Diagnostics.Tracing, Version = 4.0.10.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a ". TPLDataflow4.5.2Demo
Warning 3 Namespace or type specified in the import system. Treading.Tasks.Dataflow 'does not contain any open item or cannot be found. Make sure the namespace or type is defined and contains at least one public element. Make sure the name of the imported item does not use any aliases. F: \ Projects \ TPLDataflow4.5.2Demo \ TPLDataflow4.5.2Demo \ MainWindow.xaml.vb 1 9 TPLDataflow4.5.2Demo
Error 4 The type "System.Threading.Tasks.Dataflow.BufferBlock" is undefined. F: \ Projects \ TPLDataflow4.5.2Demo \ TPLDataflow4.5.2Demo \ MainWindow.xaml.vb 4 21 TPLDataflow4.5.2Demo
Decision:
It turns out that the Microsoft .NET Framework 4.5.2 SDK that I was using had a bug that prevented the PCL from compiling correctly.
I downloaded and installed the updated version of Microsoft .NET Framework 4.5.2 Developer Kit from http://support.microsoft.com/kb/2901951 and my application was able to compile without errors.
source to share
There is a connect ticket that states using .NET 4.5.2 with PCL libraries causing build failures.
This has been fixed in the Microsoft Developer Framework 4.5.2 Developer Pack
When you recompile a Microsoft .NET Framework 4.5.1 application that uses .NET Portable Libraries to target Microsoft .NET Framework 4.5.2, you receive the following error during compilation:
The type '{type}' is defined in an assembly that is not referenced. You must add a reference to assembly '{assembly}'
source to share