Project using PCL 'TPL Dataflow' won't compile when targetting .NET 4.5.2 - task-parallel-library

I'm using Windows 7 Pro x64 SP1 and Visual Studio 2012 Update 4. I can't get my VB.NET WPF project to compile when using the TPL Dataflow package and .NET 4.5.2. I've created a base project with nothing except this code and compile only for x64:
Imports System.Threading.Tasks.Dataflow
Class MainWindow
Dim test As New System.Threading.Tasks.Dataflow.BufferBlock(Of String)
End Class
I've tried adding the facade reference to System.Runtime.dll and System.Diagnostics.Tracing.dll with no effect. It compiles fine if I change to .NET 4.5. I must have a reference to 4.5.2 because of other features that will be in the project that require it.
Specific errors:
Warning 1 The primary reference "System.Threading.Tasks.Dataflow, Version=4.5.23.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.5.2". To resolve this problem, either remove the reference "System.Threading.Tasks.Dataflow, Version=4.5.23.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" or retarget your application to a framework version which 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" could not be resolved because it has an indirect dependency on the framework assembly "System.Diagnostics.Tracing, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.5.2". To resolve this problem, either remove the reference "System.Threading.Tasks.Dataflow, Version=4.5.23.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Diagnostics.Tracing, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". TPLDataflow4.5.2Demo
Warning 3 Namespace or type specified in the Imports 'System.Threading.Tasks.Dataflow' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. F:\Projects\TPLDataflow4.5.2Demo\TPLDataflow4.5.2Demo\MainWindow.xaml.vb 1 9 TPLDataflow4.5.2Demo
Error 4 Type 'System.Threading.Tasks.Dataflow.BufferBlock' is not defined. F:\Projects\TPLDataflow4.5.2Demo\TPLDataflow4.5.2Demo\MainWindow.xaml.vb 4 21 TPLDataflow4.5.2Demo
Solution:
It turns out the Microsoft .NET Framework 4.5.2 Developer Pack I was using had a bug that wouldn't let PCLs compile correctly.
I downloaded and installed the updated version of the Microsoft .NET Framework 4.5.2 Developer Pack from http://support.microsoft.com/kb/2901951 and my application was able to compile without errors.

There is a ticket on connect specifying the use of .NET 4.5.2 with PCL libraries causing builds to fail.
This was fixed in the Microsoft .NET Framework 4.5.2 Developer Pack
When you recompile a Microsoft .NET Framework 4.5.1 application that uses .NET portable libraries to target the Microsoft .NET Framework 4.5.2, you receive the following error message during compilation:
The type '{type}' is defined in an assembly that is not referenced. You must add a reference to assembly '{assembly}'

Related

Error running sample Microsoft UCMA 4.0 sample in Visual Studio 2013

I just want to test prebuilt Microsoft UCMA 4.0 Quickstart sample Application from Visual Studio 2013.
If i press Start, I get the warning:
Warning 1 The primary reference "Microsoft.Rtc.Collaboration, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the assembly "System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" which was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0". RecorderSample
and a bunch of errors, for example:
Error 3 The type or namespace name 'AudioVideo' does not exist in the namespace 'Microsoft.Rtc.Collaboration' (are you missing an assembly reference?) C:\Program Files\Microsoft UCMA 4.0\SDK\Core\Sample Applications\QuickStarts\AudioVideoCall\Recorder\RecorderSample.cs 10 35 RecorderSample
I have .net framework 4.5.1 on my pc
I resolved by going to project, project properties, application, target framework and changing to 4.5.1

Upgrading VS2010 to 2013 introduced compile error with SendGrid

I installed the ultimate trial of Visual Studio 2013 yesterday to see if it had any negative impact on our current 2010 based projects. When trying to compile a project that previously had no problems and still compiles on my colleagues computers I encountered this error:
The type or namespace name 'SendGridMail' could not be found (are you missing a using directive or an assembly reference?)
The error is the same when run from Visual Studio 2010 or 2013
Looking at similar questions on here suggests that this happens when using the .net 4 Client Profile instead of standard .net 4, but this project has always used standard .net 4.
Another question was using the latest version of sendgrid (4.x) with .net 4 which I understand doesn't work, but we are using an older version (1.2.1).
Personally I have tried:
Removing and Readding the reference (originally it was referenced inside the project, I also tried referencing it externally)
Running Visual Studio with no addons
Recreating the project in another solution
The only luck I have had so far has been to use nuget to install the sendgrid package instead but this seems to add a lot of additional files and at the moment I'm more interested in why a previously working build has stopped working with no changes to the project other than installing another version of Visual Studio.
Edit:
This is the output when trying to build with the SendGridMail dll (succeeds since it's not used in code):
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3268: The primary reference "SendGridMail, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0". To resolve this problem, either remove the reference "SendGridMail, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3268: The primary reference "SendGridMail, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Threading.Tasks, Version=2.5.19.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0". To resolve this problem, either remove the reference "SendGridMail, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Threading.Tasks, Version=2.5.19.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3268: The primary reference "SendGridMail, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Runtime, Version=2.5.19.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0". To resolve this problem, either remove the reference "SendGridMail, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Runtime, Version=2.5.19.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
I was able to resolve this by removing the .NET 4.5 SDK (but not the framework itself). I assume it was looking at the latest framework for the dlls despite the project being set to .NET 4

Fails to Compile C# project due to primary reference

I'm trying to compile the project with targeted framework as ".NETFramework 4.0". But I get the following warning:
The primary reference "XXX" could not be resolved because it has an
indirect dependency on the framework assembly
"System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089" which could not be resolved in the
currently targeted framework. ".NETFramework,Version=v4.0". To resolve
this problem, either remove the reference "Fdi" or retarget your
application to a framework version which contains
"System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089".
I found an earlier (but similar) problem: Visual Studio 2010: Reference Assemblies Targeting Higher Framework Version
Johannes Rudolph found this answer on MSDN's forums ( http://social.msdn.microsoft.com/Forums/en-US/msbuild/thread/dfadfb34-5328-4c53-8274-931c6ae00836 ):
However, there're 2 workarounds.
Option 1:
Step1: Unload the referencing project targeting .NET 2.0
Step2: Right click the unloaded project and select edit from context menu
Step3: Add <SpecificVersion>true</SpecificVersion> to the reference.
Below is a sample from my repro solution:
<ProjectReference Include="..\HighFX\HighFX.csproj">
<Project>{8DD71CAF-BEF7-40ED-9DD0-25033CD8009D}</Project>
<Name>HighFX</Name>
<SpecificVersion>true</SpecificVersion>
</ProjectReference>
Step4: Reload the project.
Now your should be able to build within the Visual Studio 2010, there could still be a warning as below, but the build can be successful.
Warning 1 The project 'XXX' cannot be referenced. The referenced project is targeted to a higher framework version (3.5)
Option2:
Use the command line tool csc.exe to build each of your source file, which won't prevent the building.

Having errors running JigLibX 0.3.1 on XNA 4.0

Warning 1:
The referenced assembly "Microsoft.Xna.Framework.Content.Pipeline,
Version=4.0.0.0,Culture=neutral, PublicKeyToken=842cf8be1de50553"
could not be resolved because it has a dependency on
"Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" which is not in the currently
targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please
remove references to assemblies not in the targeted framework or
consider retargeting your project. JigLibX
Warning 2:
The referenced assembly "Microsoft.Xna.Framework.Content.Pipeline,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553"
could not be resolved because it has a dependency on
"Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" which is not in the currently
targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please
remove references to assemblies not in the targeted framework or
consider retargeting your project. JigLibX
Error 3:
Error loading pipeline assembly "HeightmapProcessor, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null". JigLibGame
How can I solve this?
Your assembly (you didn't give details - is it an application? a game? a library? a content pipeline extension?) is depending on the XNA content pipeline assemblies, which themselves require the full .NET 4 framework -- currently you are targeting the .NET 4 Client Profile framework.
You need to do exactly what the exception says:
You could remove the assembly references to the content pipeline assemblies, if that is possible.
Or you could change the target framework. To do this, right click your project in the Solution Explorer, select Properties, on the Application tab find the Target framework drop-down and change from ".NET Framework 4 Client Profile" to ".NET Framework 4"
It is worth pointing out that the XNA content pipeline assemblies are not redistributable: you cannot include them with your game.

MSBUILD 4.0 Fails on AJAX Extensions

We have a .Net 2.0 web app and are converting the solution and projects to Visual Studio 2010 (they were Visual Studio 2005). We are leaving the project targeting Framework 2.0. The app includes Ajax extensions. We did the conversion and can build the project successfully on the server using Visual Studio. However, when we attempt to build the project through MSBUILD 4.0, we get errors on pages where ajax controls are used, such as the following:
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9):
warning MSB3267: The primary reference
"System.Web.Extensions,
Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35,
processorArchitecture=MSIL", which is
a framework assembly, could not be
resolved in the currently targeted
framework.
".NETFramework,Version=v2.0". To
resolve this problem, either remove
the reference "System.Web.Extensions,
Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35,
processorArchitecture=MSIL" or
retarget your application to a
framework version which contains
"System.Web.Extensions,
Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35,
processorArchitecture=MSIL".
[C:\Inetpub\wwwroot\gmrcwebsite\GMRCWebsite.vbproj]
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9):
warning MSB3268: The primary reference
"System.Web.Extensions.Design,
Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35,
processorArchitecture=MSIL" could not
be resolved because it has an indirect
dependency on the framework assembly
"System.Web.Extensions,
Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" which
could not be resolved in the currently
targeted framework.
".NETFramework,Version=v2.0". To
resolve this problem, either remove
the reference
"System.Web.Extensions.Design,
Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35,
processorArchitecture=MSIL" or
retarget your application to a
framework version which contains
"System.Web.Extensions,
Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35".
[C:\Inetpub\wwwroot\gmrcwebsite\GMRCWebsite.vbproj]
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9):
warning MSB3268: The primary reference
"AjaxControlToolkit,
Version=1.0.10618.0, Culture=neutral,
PublicKeyToken=28f01b0e84b6d53e,
processorArchitecture=MSIL" could not
be resolved because it has an indirect
dependency on the framework assembly
"System.Web.Extensions,
Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" which
could not be resolved in the currently
targeted framework.
".NETFramework,Version=v2.0". To
resolve this problem, either remove
the reference "AjaxControlToolkit,
Version=1.0.10618.0, Culture=neutral,
PublicKeyToken=28f01b0e84b6d53e,
processorArchitecture=MSIL" or
retarget your application to a
framework version which contains
"System.Web.Extensions,
Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35".
[C:\Inetpub\wwwroot\gmrcwebsite\GMRCWebsite.vbproj]
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9):
warning MSB3267: The primary reference
"System.Web.Extensions.Design,
Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35,
processorArchitecture=MSIL", which is
a framework assembly, could not be
resolved in the currently targeted
framework.
".NETFramework,Version=v2.0". To
resolve this problem, either remove
the reference
"System.Web.Extensions.Design,
Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35,
processorArchitecture=MSIL" or
retarget your application to a
framework version which contains
"System.Web.Extensions.Design,
Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35,
processorArchitecture=MSIL".
[C:\Inetpub\wwwroot\gmrcwebsite\GMRCWebsite.vbproj]
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9):
warning MSB3268: The primary reference
"AjaxControlToolkit,
Version=1.0.10618.0, Culture=neutral,
PublicKeyToken=28f01b0e84b6d53e,
processorArchitecture=MSIL" could not
be resolved because it has an indirect
dependency on the framework assembly
"System.Web.Extensions.Design,
Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" which
could not be resolved in the currently
targeted framework.
".NETFramework,Version=v2.0". To
resolve this problem, either remove
the reference "AjaxControlToolkit,
Version=1.0.10618.0, Culture=neutral,
PublicKeyToken=28f01b0e84b6d53e,
processorArchitecture=MSIL" or
retarget your application to a
framework version which contains
"System.Web.Extensions.Design,
Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35".
[C:\Inetpub\wwwroot\gmrcwebsite\GMRCWebsite.vbproj]
...
error BC30451: 'ScriptManager' is not
declared. It may be inaccessible due
to its protection level. error
BC30002: Type
'System.Web.UI.ScriptManager' is not
defined. error BC30002: Type
'System.Web.UI.UpdatePanel' is not
defined. error BC30002: Type
'System.Web.UI.UpdateProgress' is not
defined.
This stuff worked fine before and builds and works fine when built through Visual Studio. What do we need to do to fix these errors?
I just had the same problem myself after configuring TFS Build service 2008 to use MSBuild 4.0. Everything worked before converting the projects, after then conversion to 2010 format and the switch to MSBuild 4 suddenly it couldn't find the 1.0.61025.0 AJAX libraries.
It turned out there was a registry key missing that pointed to the install location of MS Ajax extensions.
On my dev box the key that should be located at (64-bit OS)
HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx\ASP.NET AJAX Extensions
was instead placed in HKEY_CURRENT_USER. (32-bit OS: remove the Wow6432Node part)
On the build server the key was missing completely (none of the locally present user profiles had it in its registry hive).
The default value of this key should point to the MS Ajax Extensions installation directory, which in my case is
C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\v1.0.61025
After recreating the key on the build server, our solution builds successfully under MSBuild 4.
It remains a mystery to me why it built successfully until now (under MSBuild 3.5). Perhaps the assembly search algorithm changed slightly and is now more restrictive.
Hope that helps.
Hello here you'll find the solution: http://www.developerit.com/2010/04/19/ms-ajax-libraries-and-configured-assemblies

Resources