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".
I'll check the references later, thanks
On 26 September 2014 17:25, Jef Statham [email protected] wrote:
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".
— Reply to this email directly or view it on GitHub https://github.com/StackExchange/StackExchange.Redis/issues/96.
Regards,
Marc
Are you perhaps targeting 4.0 "client profile" ?
On 26 September 2014 17:32, Marc Gravell [email protected] wrote:
I'll check the references later, thanks
On 26 September 2014 17:25, Jef Statham [email protected] wrote:
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".
— Reply to this email directly or view it on GitHub https://github.com/StackExchange/StackExchange.Redis/issues/96.
Regards,
Marc
Regards,
Marc
Double checked that a few times. I'm targeting the full 4.0.
Mgravell, I am also facing this issue with MSBuild in my build machine, not able to compile projects with .Net 4.0. I have to use .Net 4.0 only. Its building with Visual studio 2010 but while builing with MSBUILD its not builing. I have got stackexchange.redis via nuget. I have tried all options in setting bindingRedirect oldVersion="1.5.11.0" newVersion="2.6.9.0" also, nothing is helping. Please help in resolving.
Error details:
C:\Users\Vijayanand\Documents\Visual Studio 2010\Projects\redis4package\redisweb.metaproj : warning MSB3268: The primary reference "C:\Users\Vijayanand\Documents\Visual Studio 2010\Projects\redis4package\redis4package\bin\redis4package.dll" could not be resolved because it has an indirect dependency on the framework assembly "System.Runtime, Version=1.5.11.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 "C:\Users\Vijayanand\Documents\Visual Studio 2010\Projects\redis4package\redis4package\bin\redis4package.dll" or retarget your application to a framework version which contains "System.Runtime, Version=1.5.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
C:\Users\Vijayanand\Documents\Visual Studio 2010\Projects\redis4package\redisweb.metaproj : warning MSB3268: The primary reference "C:\Users\Vijayanand\Documents\Visual Studio 2010\Projects\redis4package\redis4package\bin\redis4package.dll" could not be resolved because it has an indirect dependency on the framework assembly "System.Threading.Tasks, Version=1.5.11.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 "C:\Users\Vijayanand\Documents\Visual Studio 2010\Projects\redis4package\redis4package\bin\redis4package.dll" or retarget your application to a framework version which contains "System.Threading.Tasks, Version=1.5.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
C:\Users\Vijayanand\Documents\Visual Studio 2010\Projects\redis4package\redisweb.metaproj : warning MSB3268: The primary reference "C:\Users\Vijayanand\Documents\Visual Studio 2010\Projects\redis4package\redisreferance\bin\redisreferance.dll" could not be resolved because it has an indirect dependency on the framework assembly "System.Runtime, Version=1.5.11.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 "C:\Users\Vijayanand\Documents\Visual Studio 2010\Projects\redis4package\redisreferance\bin\redisreferance.dll" or retarget your application to a framework version which contains "System.Runtime, Version=1.5.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". C:\Users\Vijayanand\Documents\Visual Studio 2010\Projects\redis4package\redisweb.metaproj : warning MSB3268: The primary reference "C:\Users\Vijayanand\Documents\Visual Studio 2010\Projects\redis4package\redisreferance\bin\redisreferance.dll" could not be resolved because it has an indirect dependency on the framework assembly "System.Threading.Tasks, Version=1.5.11.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 "C:\Users\Vijayanand\Documents\Visual Studio 2010\Projects\redis4package\redisreferance\bin\redisreferance.dll" or retarget your application to a framework version which contains "System.Threading.Tasks, Version=1.5.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Mgravell, we are unable to resolve this issue still, can you help me in solving.
Re the originally reported issue, I simply cannot reproduce this. If I start a 4.0 project, add SE.Redis, it just works. Is there a set of steps to repro?
On 26 September 2014 21:41, Jef Statham [email protected] wrote:
Double checked that a few times. I'm targeting the full 4.0.
— Reply to this email directly or view it on GitHub https://github.com/StackExchange/StackExchange.Redis/issues/96#issuecomment-57017524 .
Regards,
Marc
Re "redis4package" - I have no way of knowing what you've done there; it is a different message to the original one; I can only guess "inappropriate versions of Microsoft.Bcl.Async" / "Microsoft.Bcl". It should be noted that the current 4.0 build of SE.Redis references "System.Threading.Tasks" via "Microsoft.Bcl" 1.1.9; specifically, relative to the project root, the System.Threading.Tasks.dll reference is \packages\Microsoft.Bcl.1.1.9\lib\net40\System.Threading.Tasks.dll
If you are referencing the regular System.Threading.Tasks.dll, then yeah, that won't work in 4.0.
On 13 November 2014 08:51, Vijay27anand [email protected] wrote:
Mgravell, we are unable to resolve this issue still, can you help me in solving.
— Reply to this email directly or view it on GitHub https://github.com/StackExchange/StackExchange.Redis/issues/96#issuecomment-62859678 .
Regards,
Marc
mgravell,
I have created a sample project for recreating what we face. Its Visual studio 2010 solution. Please note that we are using .Net 4.0 MSBUILD for building. If we open is VS 2010 we are able to compile, but our requirement is to use MSBUILD in build machine. With MS build its not working. You can try with VS 2010 command promt MSBUILD. I have uploaded my sample project similar to our project in Dropbox and link is
https://www.dropbox.com/l/Iri3eomLNk3aWMXxkz1q9p or https://www.dropbox.com/s/7lca4dp0kp6sz17/redis4package.zip
I have give the screen shot and the msbuild.log. If we try with Visual studio build and thry msbuild it might work as dlls are copied to bin folder or webproject. So clean all the dlls in all 3 projects and try with MSBUiLD, it will be easily reproducable.
mgravell,
Are you able to recreate with the sample code I have posted with msbuild .net 4?
Yes; can reproduce; to confirm, it looks like the Microsoft.Threading.Tasks.dll in Microsoft.Bcl.Async.1.0.168/lib/net40 is what references System.Runtime v1.5.11
I tried updating the build tasks to latest (21 instead of 14), but that made no difference.
I tried installing KB2468871 (mentioned on the Microsoft.Bcl.Asnyc NuGet page), but it wouldn't install for me, so I assume I already have it.
Searching for the error text took me here: http://blogs.msdn.com/b/bclteam/p/asynctargetingpackkb.aspx
Which suggests adding a binding redirect, but I can see that you already have this for all 3.
Long story short; it looks like the 4,0 build tools simply don't work very well for _web site_s. Unless I am mistaking it, it seems to work ok for web projects (i.e. where a csproj is in play) - but not for naked web-sites. Since the source of the problem seems to be in Microsoft.Bcl.Async and the .NET 4.0 build tools for web-sites, frankly I'm not sure what (if anything) I can do about this, other than to suggest "don't do that". The SE.Redis package is referencing the right things...
Hello,
Was this ever resolved? I am facing the same issue. Please let me know for any possible solution.
Thanks in advance.
We have migrated our code to .Net 4.5 to work well. It does not work well with .net 4.0 website projects. So you have to convert to 4.5 or with .net 4.0 convert the website to project with csproj.
Got it. I will give it a shot. Thanks for the prompt reply.
I had this issue (warning: MSB3268) in a .net 4 class library project (on VS 2013). please check the following steps. my problem solved:
- check right versions in bindingRedirect of your app.config or web.config.

2.check if Microsoft.Bcl.Build msbuild target file imported to your project properly.

read this issue about installing nuget packages: https://nuget.codeplex.com/workitem/3072
hope checking these steps solve your problem.
Trying for 64 bit builds in Windows 7 and StackExchange.Redis_Net40 - or any StackExchange for that matter. Could not even load several of the projects (Docs, ConnectionWatcher, BasicTest) because they required .Net 4.5 in the project files. Manually edited project file to 4.0 so they would at least load. Then found that .Net 4.5 specific calls (ZipArchive zip in ConnectionMultiplexoer.cs) were used when I tried to build using VS 2013. VS 2010 had 68 code errors in just the ConnectionMultiplexor, then quit. Looked at Microsoft.Bcl.Build 1.0.21 and it doesn't have any "<Import" commands in it. StackExchange.Redis that I am trying to build was downloaded from GitHub on April 27, 2015 as a zip file. I have not found where the version information is located, if in fact there is any. Use of .Net 4.5 is not an option at this time and VS 2013 is not in active use for development - maybe later this year.
K, thanks. I'll fix that as part of the branch I'm working on currently. On 7 May 2015 2:37 pm, "roadkill42" [email protected] wrote:
Trying for 64 bit builds in Windows 7 and StackExchange.Redis_Net40 - or any StackExchange for that matter. Could not even load several of the projects (Docs, ConnectionWatcher, BasicTest) because they required .Net 4.5 in the project files. Manually edited project file to 4.0 so they would at least load. Then found that .Net 4.5 specific calls (ZipArchive zip in ConnectionMultiplexoer.cs) were used when I tried to build using VS 2013. VS 2010 had 68 code errors in just the ConnectionMultiplexor, then quit. Looked at Microsoft.Bcl.Build 1.0.21 and it doesn't have any "<Import" commands in it. StackExchange.Redis that I am trying to build was downloaded from GitHub on April 27, 2015 as a zip file. I have not found where the version information is located, if in fact there is any. Use of .Net 4.5 is not an option at this time and VS 2013 is not in active use for development - maybe later this year.
— Reply to this email directly or view it on GitHub https://github.com/StackExchange/StackExchange.Redis/issues/96#issuecomment-99867861 .
Binding redirects are broken in the current version, or at least NuGet messes with it. NuGet installs 2.6.9.0 BCL assemblies, but StackExcange.Redis references the 2.6.10 ones so the project does not compile (it is a class library, not a web project).
To fix the problem, replace
<bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0" />
binding redirects with
<bindingRedirect oldVersion="0.0.0.0-2.6.10.0" newVersion="2.6.10.0" />
in the app.config/web.config of your project and and in every other projects that references that assembly.
Hellow, I'm trying to type a simple code
var conf = new ConfigurationOptions { KeepAlive = 180, Password = "", // DefaultVersion = new Version("2.8.5"), AllowAdmin = true, EndPoints = { {"localhost", 6379} } };
var connection = ConnectionMultiplexer.Connect(conf);
but in debug i getting the following : "Could not load file or assembly 'System.Threading.Tasks, Version=2.6.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"
I'm working with .net fraimwork 4.0. when i downloaded Stackexchenge.Redis , It has automaticly dowloaded System.Threading.Tasks version 2.6.9
How can I resolve this problem ?
@orlycohen See my comment above yours.
Thank you , can you post a link to dll 'System.Threading.Tasks, Version=2.6.10.0 download I cant find it on a web...