Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for .NET 4 #11

Closed

Conversation

TheCloudlessSky
Copy link

Hey Marc,

I'm interested in adding support for .NET 4. I maintain a few libraries using Redis that I'm switching over from ServiceStack.Redis. However, I'd like to maintain .NET 4 support for those that require it. All of my apps use .NET 4.5, so it isn't a problem. I dropped the framework version to 4.0 and started digging. Here's what's needed:

  • Support async on .NET 4. From what I've read, this means taking a dependency on Microsoft.Bcl.Async.

  • Make an implementation of ZipArchive (perhaps using System.IO.Packaging).

  • Conditionally support Environment.CurrentManagedThreadId:

    #if NET40
        int currentThread = Thread.CurrentThread.ManagedThreadId;
    #else
        int currentThread = Environment.CurrentManagedThreadId;
    #endif
    
  • Implementation for Dns.GetHostAddressesAsync()

  • Implementation for Task.Delay(), Task.WhenAll() and Task.WhenAny().

  • Update the build process to support building packages for lib\net40 and lib\net45.

Would this be something you're willing to pull in?

@mgravell
Copy link
Collaborator

mgravell commented Apr 8, 2014

Absolutely. I will need to review it, though, which I can't so until next week. Away from computers for a few days!

@TheCloudlessSky
Copy link
Author

Cool. I'll continue updating this PR as I pick away at the list.

@mgravell
Copy link
Collaborator

I have pushed changes that should make it usable on 4.0; unfortunately my build server isn't happy with it right now, so I haven't updated the deploy - but: could you give it a go locally and let me know?

@mgravell mgravell closed this Apr 14, 2014
@mgravell mgravell reopened this Apr 14, 2014
@TheCloudlessSky
Copy link
Author

Awesome - that works. Do you know of a way to make the Nuget dependencies conditional for the framework version? Or are you ok with adding the dependencies for all versions?

@mgravell
Copy link
Collaborator

Updated: this should work now; > Install-Package StackExchange.Redis -Version 1.0.266

@mgravell
Copy link
Collaborator

re conditional: that should already be the case, but I've just tested it and found that it didn't work quite right; investigating (which is also why I've hidden 266)

@mgravell
Copy link
Collaborator

Fixed in 270: https://www.nuget.org/packages/StackExchange.Redis/1.0.270:

Dependencies

.NETFramework 4.0
Microsoft.Bcl (≥ 1.1.8)
Microsoft.Bcl.Async (≥ 1.0.168)
Microsoft.Bcl.Build (≥ 1.0.14)

.NETFramework 4.5
No dependencies.

@mgravell mgravell closed this Apr 14, 2014
@TheCloudlessSky TheCloudlessSky deleted the net40-support branch April 14, 2014 15:25
@TheCloudlessSky
Copy link
Author

Perfect - I just confirmed that it's working for 4 and 4.5 projects. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants