{"action":"created","issue":{"url":"https://api.github.com/repos/NuGet/Home/issues/1625","labels_url":"https://api.github.com/repos/NuGet/Home/issues/1625/labels{/name}","comments_url":"https://api.github.com/repos/NuGet/Home/issues/1625/comments","events_url":"https://api.github.com/repos/NuGet/Home/issues/1625/events","html_url":"https://github.com/NuGet/Home/issues/1625","id":112817707,"number":1625,"title":"dotnet TFM and Portable Class Libraries appear incompatible","user":{"login":"tillig","id":1156571,"avatar_url":"https://avatars.githubusercontent.com/u/1156571?v=3","gravatar_id":"","url":"https://api.github.com/users/tillig","html_url":"https://github.com/tillig","followers_url":"https://api.github.com/users/tillig/followers","following_url":"https://api.github.com/users/tillig/following{/other_user}","gists_url":"https://api.github.com/users/tillig/gists{/gist_id}","starred_url":"https://api.github.com/users/tillig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tillig/subscriptions","organizations_url":"https://api.github.com/users/tillig/orgs","repos_url":"https://api.github.com/users/tillig/repos","events_url":"https://api.github.com/users/tillig/events{/privacy}","received_events_url":"https://api.github.com/users/tillig/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/NuGet/Home/labels/Viewed","name":"Viewed","color":"f7c6c7"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-10-22T14:41:13Z","updated_at":"2015-10-23T15:20:34Z","closed_at":"2015-10-23T00:55:51Z","body":"I'm unsure if this is a bug, but it's making life difficult so I figured I'd report it. ([My original blog entry about it is here.](http://www.paraesthesia.com/archive/2015/10/20/gotcha-with-dnx-dependency-resolution-dotnet-pcl/))\r\n\r\nI'm also not entirely sure if this is a `dnu` issue or a NuGet issue.\r\n\r\nWe recently released [Autofac 4.0.0-beta8-157](https://www.nuget.org/packages/Autofac/4.0.0-beta8-157) to NuGet to coincide with the DNX beta 8 release. As part of that update, we re-added the classic PCL target `.NETPortable,Version=v4.5,Profile=Profile259` (which is `portable-net45+dnxcore50+win+wpa81+wp80+MonoAndroid10+Xamarin.iOS10+MonoTouch10`) because older VS versions and some project types were having trouble finding a compatible version of Autofac 4.0.0 - they didn't rectify the `dotnet` target framework as a match.\r\n\r\nIn working on a beta 8 compatible version of [Autofac.Configuration](https://github.com/autofac/Autofac.Configuration), which targeted `dnx451`, `dotnet`, and `net45` in beta 7, I figured we could just update to start using Autofac 4.0.0-beta8-157.\r\n\r\nInstead, I started getting a lot of build errors when targeting the `dotnet` framework moniker.\r\n\r\n```\r\nBuilding Autofac.Configuration for .NETPlatform,Version=v5.0\r\n  Using Project dependency Autofac.Configuration 4.0.0-beta8-1\r\n    Source: E:\\dev\\opensource\\Autofac\\Autofac.Configuration\\src\\Autofac.Configuration\\project.json\r\n\r\n  Using Package dependency Autofac 4.0.0-beta8-157\r\n    Source: C:\\Users\\tillig\\.dnx\\packages\\Autofac\\4.0.0-beta8-157\r\n    File: lib\\dotnet\\Autofac.dll\r\n\r\n  Using Package dependency Microsoft.Framework.Configuration 1.0.0-beta8\r\n    Source: C:\\Users\\tillig\\.dnx\\packages\\Microsoft.Framework.Configuration\\1.0.0-beta8\r\n    File: lib\\dotnet\\Microsoft.Framework.Configuration.dll\r\n\r\n  Using Package dependency Microsoft.Framework.Configuration.Abstractions 1.0.0-beta8\r\n    Source: C:\\Users\\tillig\\.dnx\\packages\\Microsoft.Framework.Configuration.Abstractions\\1.0.0-beta8\r\n    File: lib\\dotnet\\Microsoft.Framework.Configuration.Abstractions.dll\r\n\r\n  Using Package dependency System.Collections 4.0.11-beta-23409\r\n    Source: C:\\Users\\tillig\\.dnx\\packages\\System.Collections\\4.0.11-beta-23409\r\n    File: ref\\dotnet\\System.Collections.dll\r\n\r\n  (...and some more package dependencies that got resolved, then...)\r\n\r\n  Unable to resolve dependency fx/System.Collections\r\n\r\n  Unable to resolve dependency fx/System.ComponentModel\r\n\r\n  Unable to resolve dependency fx/System.Core\r\n\r\n  (...and a lot more fx/* items unresolvable.)\r\n```\r\n\r\nThis was, at best, confusing. I mean, in the same target framework, I see these two things together:\r\n\r\n```\r\n  Using Package dependency System.Collections 4.0.11-beta-23409\r\n    Source: C:\\Users\\tillig\\.dnx\\packages\\System.Collections\\4.0.11-beta-23409\r\n    File: ref\\dotnet\\System.Collections.dll\r\n\r\n  Unable to resolve dependency fx/System.Collections\r\n```\r\n\r\nSo it _found_ System.Collections, but it _didn't find_ System.Collections? Running the `dnu list --details` command, I saw this:\r\n\r\n```\r\n[Target framework .NETPlatform,Version=v5.0 (dotnet)]\r\n\r\nFramework references:\r\n  fx/System.Collections  - Unresolved\r\n    by Package: Autofac 4.0.0-beta8-157\r\n\r\n  fx/System.ComponentModel  - Unresolved\r\n    by Package: Autofac 4.0.0-beta8-157\r\n\r\n  (...and a bunch more of these...)\r\n\r\n\r\nPackage references:\r\n* Autofac 4.0.0-beta8-157\r\n    by Project: Autofac.Configuration 4.0.0-beta8-1\r\n\r\n* Microsoft.Framework.Configuration 1.0.0-beta8\r\n    by Project: Autofac.Configuration 4.0.0-beta8-1\r\n\r\n  Microsoft.Framework.Configuration.Abstractions 1.0.0-beta8\r\n    by Package: Microsoft.Framework.Configuration 1.0.0-beta8\r\n\r\n  System.Collections 4.0.11-beta-23409\r\n    by Package: Autofac 4.0.0-beta8-157...\r\n    by Project: Autofac.Configuration 4.0.0-beta8-1\r\n\r\n  (...and so on.)\r\n```\r\n\r\nWhat I see is that Autofac 4.0.0-beta8-157 needs _both_ the framework assembly _and_ the dependency package for `System.Collections` which seems weird.\r\n\r\nLooking in the generated `.nuspec` file for the updated core Autofac, I see:\r\n\r\n```xml\r\n<?xml version=\"1.0\"?>\r\n<package xmlns=\"http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd\">\r\n  <metadata>\r\n    <!-- ... -->\r\n    <dependencies>\r\n      <group targetFramework=\"DNX4.5.1\" />\r\n      <group targetFramework=\".NETPlatform5.0\">\r\n        <dependency id=\"System.Collections\" version=\"4.0.11-beta-23409\" />\r\n        <dependency id=\"System.Collections.Concurrent\" version=\"4.0.11-beta-23409\" />\r\n        <!-- ... -->\r\n      </group>\r\n      <group targetFramework=\".NETFramework4.5\" />\r\n      <group targetFramework=\".NETCore4.5\" />\r\n      <group targetFramework=\".NETPortable4.5-Profile259\" />\r\n    </dependencies>\r\n    <frameworkAssemblies>\r\n      <!-- ... -->\r\n      <frameworkAssembly assemblyName=\"System.Collections\" targetFramework=\".NETPortable4.5-Profile259\" />\r\n      <frameworkAssembly assemblyName=\"System.ComponentModel\" targetFramework=\".NETPortable4.5-Profile259\" />\r\n      <frameworkAssembly assemblyName=\"System.Core\" targetFramework=\".NETPortable4.5-Profile259\" />\r\n      <frameworkAssembly assemblyName=\"System.Diagnostics.Contracts\" targetFramework=\".NETPortable4.5-Profile259\" />\r\n      <frameworkAssembly assemblyName=\"System.Diagnostics.Debug\" targetFramework=\".NETPortable4.5-Profile259\" />\r\n      <frameworkAssembly assemblyName=\"System.Diagnostics.Tools\" targetFramework=\".NETPortable4.5-Profile259\" />\r\n      <!-- ... -->\r\n    </frameworkAssemblies>\r\n  </metadata>\r\n</package>\r\n```\r\n\r\n**The list of failed `fx/*` dependencies is exactly the same as the list of `frameworkAssembly` references that target `.NETPortable4.5-Profile259` in the `.nuspec`.**\r\n\r\nBy removing the `dotnet` target framework moniker from Autofac.Configuration and compiling for _specific targets_, everything resolves correctly.\r\n\r\nAgain, I'm not sure if this is the desired behavior, but it seems if you have a library that takes a dependency on something that targets _both_ `dotnet` and a PCL profile, you suddenly can't support `dotnet` unless you _also_ support the PCL profile.\r\n\r\nIf you'd like to try this and see it in action, check out [the Autofac.Configuration repo at `14c10b5bf6`](https://github.com/autofac/Autofac.Configuration/tree/14c10b5bf6216b1bdfb1f5414105161eeba06f9f) and run the `build.ps1` build script.\r\n\r\n**If this is a `dnu` issue, let me know so I can post the issue over on the aspnet repo.**"},"comment":{"url":"https://api.github.com/repos/NuGet/Home/issues/comments/150606030","html_url":"https://github.com/NuGet/Home/issues/1625#issuecomment-150606030","issue_url":"https://api.github.com/repos/NuGet/Home/issues/1625","id":150606030,"user":{"login":"tillig","id":1156571,"avatar_url":"https://avatars.githubusercontent.com/u/1156571?v=3","gravatar_id":"","url":"https://api.github.com/users/tillig","html_url":"https://github.com/tillig","followers_url":"https://api.github.com/users/tillig/followers","following_url":"https://api.github.com/users/tillig/following{/other_user}","gists_url":"https://api.github.com/users/tillig/gists{/gist_id}","starred_url":"https://api.github.com/users/tillig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tillig/subscriptions","organizations_url":"https://api.github.com/users/tillig/orgs","repos_url":"https://api.github.com/users/tillig/repos","events_url":"https://api.github.com/users/tillig/events{/privacy}","received_events_url":"https://api.github.com/users/tillig/received_events","type":"User","site_admin":false},"created_at":"2015-10-23T15:20:34Z","updated_at":"2015-10-23T15:20:34Z","body":"If I switch to `uap10.0` I do see that it's building for UAP 10:\r\n\r\n```\r\nBuilding Autofac.Configuration for UAP,Version=v10.0\r\n```\r\n\r\nBut with a `project.json` section like this (non-dependencies trimmed):\r\n\r\n```json\r\n{\r\n    \"dependencies\": {\r\n        \"Autofac\": \"4.0.0-beta8-*\",\r\n        \"Microsoft.Framework.Configuration\": \"1.0.0-beta8\"\r\n    },\r\n    \"frameworks\": {\r\n        \"uap10.0\": {\r\n            \"dependencies\": {\r\n                \"System.Collections\": \"4.0.11-beta-*\",\r\n                \"System.ComponentModel.TypeConverter\": \"4.0.1-beta-*\",\r\n                \"System.Diagnostics.Tools\": \"4.0.1-beta-*\",\r\n                \"System.Globalization\": \"4.0.11-beta-*\",\r\n                \"System.IO\": \"4.0.11-beta-*\",\r\n                \"System.Linq\": \"4.0.1-beta-*\",\r\n                \"System.Reflection\": \"4.1.0-beta-*\",\r\n                \"System.Reflection.Extensions\": \"4.0.1-beta-*\",\r\n                \"System.Reflection.TypeExtensions\": \"4.0.1-beta-*\",\r\n                \"System.Resources.ResourceManager\": \"4.0.1-beta-*\"\r\n            }\r\n        }\r\n    }\r\n}\r\n```\r\n\r\n**I end up with the same set of errors that I had when I target `dotnet`** - a series of things where it finds the package dependencies but can't resolve the `fx/*` counterparts:\r\n\r\n```\r\n  Using Package dependency System.Collections 4.0.11-beta-23409\r\n    Source: C:\\Users\\tillig\\.dnx\\packages\\System.Collections\\4.0.11-beta-23409\r\n    File: ref\\dotnet\\System.Collections.dll\r\n\r\n...\r\n\r\n  Unable to resolve dependency fx/System.Collections\r\n```"}}