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

[dotnet-cache] cache command should respect PackageTargetFallback element #1022

Closed
JunTaoLuo opened this issue Mar 21, 2017 · 11 comments
Closed
Assignees
Labels
Milestone

Comments

@JunTaoLuo
Copy link
Contributor

Repro: https://github.com/JunTaoLuo/DotnetCache/tree/c4d1413da5a8cc512184f701f2b9284485d2e203/Fallback

Without respecting this element, during dotnet cache, the following error will be seen at restore:

C:\Users\johluo.REDMOND\AppData\Local\Microsoft\dotnet\sdk\2.0.0-preview1-005448\NuGet.targets(97,5): error : Package Microsoft.AspNet.WebApi.Client 5.2.2 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package Microsoft.AspNet.WebApi.Client 5.2.2 supports: [C:\Users\johluo.REDMOND\AppData\Local\Temp\kz4jgjn1.iz4\Microsoft.AspNetCore.Mvc.WebApiCompatShim_1.2.0-preview1-24008\Package.csproj]
C:\Users\johluo.REDMOND\AppData\Local\Microsoft\dotnet\sdk\2.0.0-preview1-005448\NuGet.targets(97,5): error :   - net45 (.NETFramework,Version=v4.5) [C:\Users\johluo.REDMOND\AppData\Local\Temp\kz4jgjn1.iz4\Microsoft.AspNetCore.Mvc.WebApiCompatShim_1.2.0-preview1-24008\Package.csproj]
C:\Users\johluo.REDMOND\AppData\Local\Microsoft\dotnet\sdk\2.0.0-preview1-005448\NuGet.targets(97,5): error :   - portable-net45+netcore45+wp8+wp81+wpa81 (.NETPortable,Version=v0.0,Profile=wp8+netcore45+net45+wp81+wpa81) [C:\Users\johluo.REDMOND\AppData\Local\Temp\kz4jgjn1.iz4\Microsoft.AspNetCore.Mvc.WebApiCompatShim_1.2.0-preview1-24008\Package.csproj]
C:\Users\johluo.REDMOND\AppData\Local\Microsoft\dotnet\sdk\2.0.0-preview1-005448\NuGet.targets(97,5): error : One or more packages are incompatible with .NETCoreApp,Version=v2.0. 

cc @eerhardt

@JunTaoLuo
Copy link
Contributor Author

JunTaoLuo commented Mar 27, 2017

Any ETA on this @eerhardt @ramarag ?

@ramarag ramarag self-assigned this Mar 28, 2017
@ramarag
Copy link
Member

ramarag commented Mar 28, 2017

i am looking into this, there are some crossgen issues will reply when i learn more

@ramarag
Copy link
Member

ramarag commented Mar 28, 2017

The crossgen issue i am hitting is as follows:

E:\temp\cache\packages\runtime.win7-x64.microsoft.netcore.app\2.0.0-beta-001776-00\tools\crossgen.exe -readytorun -in E:\temp\cache\packages\microsoft.net.http\2.2.22\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Primitives.dll -out E:\temp\cache\usedir\Microsoft.AspNetCore.Mvc.WebApiCompatShim_1.2.0-preview1-24008\runtimopt\System.Net.Http.Primitives.dll -jitpath E:\temp\cache\packages\runtime.win7-x64.microsoft.netcore.app\2.0.0-beta-001776-00\runtimes\win7-x64\native\clrjit.dll -platform_assemblies_paths E:\temp\cache\usedir\Microsoft.AspNetCore.Mvc.WebApiCompatShim_1.2.0-preview1-24008\runtimeref;E:\temp\cache\usedir\Optimize\netcoreapp;
Microsoft (R) CoreCLR Native Image Generator - Version 4.5.22220.0                                                                                                                                                                                                                                   Copyright (c) Microsoft Corporation.  All rights reserved.
Error: Could not load file or assembly 'System.Net, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'. The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
Error compiling E:\temp\cache\packages\microsoft.net.http\2.2.22\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Primitives.dll: Could not find or load a specific file. (Exception from HRESULT: 0x80131621)
Error: compilation failed for "E:\temp\cache\packages\microsoft.net.http\2.2.22\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Primitives.dll" (0x80131621)

@weshaggard System.Net.Http.Primitives.dll listed above is PCL correct ? How are we expecting the PCL libs to get their runtime closure ? like the one from above: System.Net, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes

cc @gkhanna79

@weshaggard
Copy link
Member

weshaggard commented Mar 28, 2017

2 questions/comments.

  1. Any idea why Microsoft.NET.Http is part of this cache? We should be using System.Net.Http.
  2. For older PCL profiles we don't currently have all the shims for those. This is actually the first request I've seen for them. We planning to add them though.

@ramarag
Copy link
Member

ramarag commented Mar 28, 2017

@weshaggard It was brought in as part of transitive closure of Microsoft.AspNetCore.Mvc.WebApiCompatShim/1.2.0-preview1-24137


      "Microsoft.AspNetCore.Mvc.WebApiCompatShim/1.2.0-preview1-24137": {
        "type": "package",
        "dependencies": {
          "Microsoft.AspNet.WebApi.Client": "5.2.2",
          "Microsoft.AspNetCore.Mvc.Core": "1.2.0-preview1-24137",
          "Microsoft.AspNetCore.Mvc.Formatters.Json": "1.2.0-preview1-24137",
          "Microsoft.AspNetCore.WebUtilities": "1.2.0-preview1-24137",
          "NETStandard.Library": "1.6.1",
          "System.Runtime.Serialization.Xml": "4.3.0",
          "System.Xml.XmlSerializer": "4.3.0"
        },
...
".NETCoreApp,Version=v2.0": {
      "Microsoft.AspNet.WebApi.Client/5.2.2": {
        "type": "package",
        "dependencies": {
          "Microsoft.Net.Http": "2.2.22",
          "Newtonsoft.Json": "6.0.4"
        },

@gkhanna79
Copy link
Member

@weshaggard From what @ramarag and @eerhardt described in an offline discussion, this is happening when compiling PCLs that are packaged in a nuget package but do not carry their dependencies, either within the same package or in a dependent package.

What is our story for consuming PCL/Desktop artifacts for 2.0?

@gkhanna79
Copy link
Member

@JunTaoLuo Is this PCL expected to be part of the Antares/ASP.NET cache? If so, was this compiled before this cache feature?

@weshaggard
Copy link
Member

I don't know how this ever worked on .NET Core, as we didn't ever have a System.Net shim that would resolve that dependency. Also in general we discourage usage of Microsoft.Net.Http package for core and instead folks should use System.Net.Http.

That aside we do plan on having a number of these shims in .NET Core 2.0, in fact they were added with dotnet/corefx#17620, but I wouldn't rely on that we should definitely question whether or not Microsoft.Net.Http should be in the Asp.Net package cache when we don't want folks using it.

@gkhanna79
Copy link
Member

Thanks @weshaggard.

I don't know how this ever worked on .NET Core, as we didn't ever have a System.Net shim that would resolve that dependency

@JunTaoLuo An app using such artifacts will only work as long as they use API in such components that do not rely on the missing dependencies. Thus, during JIT time, such an app may work.

However, for crossgen, we need to have complete dependencies in place before crossgen can be attempted as it is a precompilation of the entire assembly and not specific methods.

@JunTaoLuo
Copy link
Contributor Author

We have included M.A.Mvc.WebApiCompatShim when we built our package cache previously I'll look into how it was built and share what I find.

@JunTaoLuo
Copy link
Contributor Author

We used to build this package in our package cache. We cross-gen our dll but not the PCL dependency. We had a list of explicit exclusions for the dlls of the PCL dependencies. I'm wondering if there should be a feature for this or maybe even default to skip cross-gen for PCL dependencies.

Note that I'm no longer blocked on this issue since we decided to not ship this package anymore.

@livarcocc livarcocc added this to the 2.0 milestone Apr 19, 2017
@livarcocc livarcocc added the Store label May 9, 2017
@ramarag ramarag mentioned this issue Jun 3, 2017
mmitche pushed a commit to mmitche/sdk that referenced this issue Jun 5, 2020
…0191019.1 (dotnet#1022)

- Microsoft.AspNetCore.Analyzers - 5.0.0-alpha1.19519.1
- Microsoft.AspNetCore.Mvc.Api.Analyzers - 5.0.0-alpha1.19519.1
- Microsoft.AspNetCore.Mvc.Analyzers - 5.0.0-alpha1.19519.1
- Microsoft.AspNetCore.Components.Analyzers - 5.0.0-alpha1.19519.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants