autofac/Autofac

Investigate using new 'dotnet' target framework

alexmg opened this issue · 7 comments

Extracted from a comment posted by @onovotny in issue #594.

One update here. You can read more on my blog, but the target here shouldn't be dnx451 or dnxcore*

Instead for Autofac, it should use dotnet. That is what CoreCLR things should target and will then support anything its contracts do. DNX isn't the only thing that can use it in other words.

I suspect that the Autofac main core package does not actually need any DNX-specific types/libraries, it needs CoreCLR. Then the other package (the former autofac.dnx one) does reference dnx-specifics and should target dnx*. Point being that the main autofac shouldn't as it'd work on more platforms than that.

The blog post in the quote above has some good information.

Here's my blog on the matter: http://oren.codes/2015/07/29/targeting-net-core/

Basically, install my nuget package. NuSpec.ReferenceGenerator and it'll put the right entries in the nuspec. Then just put your PCL in the \lib\dotnet dir.

@onovotny Question (you may have the answer to):

I found that with Autofac 4.0.0-beta6-110 (where we hadn't gotten the dotnet target in place yet) that if I try to create a new, standard class library - old school, not a DNX class library - VS is having trouble adding a reference to Autofac because Failed to add reference to 'System.Collections'. Please make sure that it is in the Global Assembly Cache.

For some reason, VS wants my standard .NET 4.5.2 assembly to add a reference to the DNXCore 5.0 version of the assembly rather than the PCL in the current package.

Is that something the dotnet target will end up addressing?

So the overall order for resolution is platform specific > dotnet > PCL, and that's true for both the \lib folders

What you do depends on if you put your Profile259 lib in dotnet or put a new .NET Core version in there.

If you put a Profile259 lib in \lib\dotnet, then that'll work for NuGet v3 clients. You'll need to keep portable-* for NuGet v2. Then you can put the contract dependencies in and that should work for everything 4.5+ as they're 4.0.0 versions.

I can send a PR based off the develop branch if you'd like.

Odd that a NuGet 3 client would ignore the portable-* target when working with net451 platform, then. Huh.

If you have time, a PR would be cool. I'm still wrapping my head around it.

The develop branch has been updated so the project.json stuff supports dotnet as the platform rather than the specific PCL target. I've verified compatibility for:

  • .NET 4.5.2
  • .NET 4.6
  • Universal Windows Platform
  • Windows 8.1 apps
  • DNX/DNX Core (which we already unit test)

I couldn't get Android/Xamarin ("monoandroid5.0") or iOS/Xamarin ("xamarinios1") to work because we need System.Reflection.Extensions and those don't appear to support the Xamarin platforms yet, which makes me think maybe our Xamarin support wasn't 100% to begin with.

Anyway, were updated, so... I'm going to close this and we can update develop as we find any incompatibility issues.