I have 2 projects, a Portable class library and a regular unit test project. In the Portable class library, I use NuGet to reference the Microsoft.BCL Portability pack, which comes with 2 assemblies (System.Threading.Tasks.dll
and System.Runtime.dll
both v1.5).
However, when I try to reference these same dlls in my unit test project (both with NuGet and manually browsing to the directory \packages\Microsoft.Bcl.1.0.19\lib\portable-net40+sl4+win8+wp71
), visual studio automatically points the refence to the dlls in another folder located here C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\
, which is of version 4.5.
Now a method I need to test accepts CancellationToken
as a parameter and throws the compile error: The type 'System.Threading.CancellationToken' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Threading.Tasks, Version=1.5.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
because its v4.5 library is whats referenced and not v1.5.
I have however been able to write tests for methods that does not use any of those features from the v1.5 BCL library.
Why is visual studio replacing my referenced library with the one that came with the framework? How do I tell visual studio to just use the ones I'm pointing to in a specific directory?
Using Visual Studio 2012 Update 2.