StackExchange.Redis icon indicating copy to clipboard operation
StackExchange.Redis copied to clipboard

Cannot build in .net 4.0

Open JefStat opened this issue 12 years ago • 31 comments

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".

JefStat avatar Sep 26 '14 16:09 JefStat

It is not required, just follow the instructions in my comment to fix the problem (it's starting with "To fix the problem")

qcz avatar Aug 17 '15 05:08 qcz

Yes !!! It's worked , thank you very much : )

orlycohen avatar Aug 17 '15 05:08 orlycohen

@qcz - that fixes the broken build - but when I try to run the application I get manifest error.

hiraldesai avatar Aug 27 '15 07:08 hiraldesai

@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 avatar Aug 29 '15 11:08 qcz

@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.

hiraldesai avatar Aug 29 '15 23:08 hiraldesai

@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" />

?

Wallonman avatar Oct 07 '15 09:10 Wallonman

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

montoyaedu avatar Oct 15 '15 17:10 montoyaedu

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.

pcooper avatar Dec 10 '15 16:12 pcooper

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 .

mgravell avatar Dec 10 '15 17:12 mgravell

@pcooper can you please give 1.1.553-alpha a try?

NickCraver avatar Jan 28 '16 03:01 NickCraver

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.

NickCraver avatar Nov 20 '16 21:11 NickCraver