Cannot build in .net 4.0
After adding stackexchange.redis via nuget I get the following build errors:
1> Restoring NuGet packages... 1> To prevent NuGet from downloading packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages'. 1> All packages listed in packages.config are already installed. 1>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1697,5): warning MSB3268: The primary reference "StackExchange.Redis" could not be resolved because it has an indirect dependency on the framework assembly "System.Runtime, Version=2.6.9.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 "StackExchange.Redis" or retarget your application to a framework version which contains "System.Runtime, Version=2.6.9.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". 1>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1697,5): warning MSB3268: The primary reference "StackExchange.Redis" could not be resolved because it has an indirect dependency on the framework assembly "System.Threading.Tasks, Version=2.6.9.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 "StackExchange.Redis" or retarget your application to a framework version which contains "System.Threading.Tasks, Version=2.6.9.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
It is not required, just follow the instructions in my comment to fix the problem (it's starting with "To fix the problem")
Yes !!! It's worked , thank you very much : )
@qcz - that fixes the broken build - but when I try to run the application I get manifest error.
@hiraldesai It works for me. I used this solution in many different types of .NET 4.0 projects (Console applications, WPF, WCF and ASP.net MVC projects). Just tried successfully with the latest packages from NuGet in a new console application.
What is the exact error message you got? Is the Copy Local property of the required assemblies (System.IO, System.Runtime, System.Threading.Tasks) set to true?
@qcz - I got it to work by updating the Bcl to a version that references version 2.6.10 of System.Threading.Tasks and System.Runtime. Thanks for your help. By default when installing Redis package - it installs a Bcl version that has reference to 2.6.9.
@qcz : when you say replace by : <bindingRedirect oldVersion="0.0.0.0-2.6.10.0" newVersion="2.6.10.0" />
you mean : <bindingRedirect oldVersion="0.0.0.0-2.6.10.0" newVersion="2.6.9.0" />
?
Hello,
I was facing the same problem.
Add a binding redirect was not enough.
As @qcz said, It installs 1.1.9 but references 1.1.10
I solved it by forcing an update of Bcl from 1.1.9 to 1.1.10 from nuget server
Actually:
Microsoft.Bcl 1.1.9 was updated to 1.1.10
While
Microsoft.Bcl.Build 1.0.14 was updated to 1.0.21
Hope it helps,
Edu
With NuGet 2.8 patch resolution changes, bcl and bcl.build won't automatically install to .10 and .21 respectively. I think the nuspec for SE.Redis could be updated to reflect the patch versions of bcl and bcl.build referenced in the net40 project file.
The project.json for the next build has the references correct.
On Thu, 10 Dec 2015 16:01 pcooper [email protected] wrote:
With NuGet 2.8 patch resolution changes https://docs.nuget.org/release-notes/nuget-2.8#user-content-patch-resolution-for-dependencies, bcl and bcl.build won't automatically install to .10 and .21 respectively. I think the nuspec for SE.Redis could be updated to reflect the patch versions of bcl and bcl.build referenced in the net40 project file.
— Reply to this email directly or view it on GitHub https://github.com/StackExchange/StackExchange.Redis/issues/96#issuecomment-163670008 .
@pcooper can you please give 1.1.553-alpha a try?
This is fixed in current code, but support for .NET 4.0 will be removed in the 2.x versions (it's just too much to maintain at this point). Closing this out to cleanup, but anyone finding this: you'll be able to build from the 1.x tags currently in the repo which have .NET 4.0 support. Currently, current is 1.1.608.