I am running into a dependency issue with MSBuild. I added a NuGet package for Microsoft.Tpl.Dataflow to a project in my solution. This is causing a build failure for a website project in the solution which references the first project. There seems to be an issue with getting the correct runtime version.
This is one of the many errors I get when building the solution with MSBuild.
C:\src\MyWebsite.metaproj : warning MSB3268: The primary reference "C:\src\projects\ReferencedProject\bin\Debug\ReferencedProject.dll" could not be resolved because it has an indirect dependency on the framework assembly "System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.5". To resolve this problem, either remove the reference "C:\src\projects\ReferencedProject\bin\Debug\ReferencedProject.dll" or retarget your application to a framework version which contains "System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
The confusing thing to be is that the solution builds fine in Visual Studio. Also, all the other projects in the solution build—it's only the website projects that are failing.
I have tried
- Changing the target framework for the website to 4.0 (it's currently 4.5).
- Adding an assembly reference to System.Runtime.dll version 4.0.0.0
I still can't get it to build. How can I fix this?