Skip to content

nuget restore should add pack files to the compile/runtime sections of assets.json #4514

Closed

Description

@livarcocc

Have a project A and a Project B.

Project A has a ProjectReference to Project B.

And ProjectB has something like this in its csproj:

<ItemGroup>
    <Content Include="runtimes\win7-x86\native\**\*">
      <PackagePath>lib\$(TargetFramework)</PackagePath>
      <Pack>true</Pack>
    </Content>
  </ItemGroup>

The assemblies under native won't show up in the compile/runtime sections of A's ProjectReference to B in the assets.json file. While, if A referenced B as a nupkg, it would. This forces people to reference projects as packages when they could just reference them as projects.

Once this gets fixed in NuGet, then additional changes will need to be made in the SDK as well.

See dotnet/sdk#765.

Activity

  1. added this to the 4.0 RTM milestone on Feb 6, 2017
  2. rrelyea commented on Feb 6, 2017

    @rrelyea
    Contributor

    @emgarten - please investigate and understand impact if we take for 4.0 or 4.0.1.

  3. emgarten commented on Feb 6, 2017

    @emgarten
    Member

    We discussed this for restore/pack, it is a major feature that we decided not to take for RTM due to the size.

    DNX supported this by defining all additional files in project.json under pack includes. Restore then added these into the lock file.

    With MSBuild finding all assets is more involved than just reading a static json file.

    To make this work we will need:

    1. Restore runs the pack target against every project to find all assets. This needs to happen both in MSBuild and in Visual Studio (unclear how this can work in Visual Studio currently)
    2. Restore runs nearest TFM asset selection against the result of pack (already in place from the p2p transitive changes)
    3. Dotnet CLI, MSbuild, and Visual Studio need to be updated to rely on the assets.json file for all project outputs instead of reading the project directly to find them. Without this we will always have inconsistent results.

    Additional complications/open questions:

    • Packing several projects into one package with ref and runtime assemblies changes the depth of the graph
    • Flags such as IncludeReferenceProjects also change the depth of the graph which changes the resolver result
    • Finding p2p references is already the majority of restore time. Finding all assets from projects also would impact perf also.
    • Is it possible to find all assets that would be in the packed nupkg without building first?
  4. modified the milestones: , 4.0 RTM on Feb 8, 2017
  5. rrelyea commented on Feb 8, 2017

    @rrelyea
    Contributor

    Moving to 4.0.1 - just trying to confirm in linked issue that they don't absolutely need it in rtm.

  6. modified the milestones: Future-0, Backlog on Nov 9, 2017
  7. emgarten commented on Nov 9, 2017

    @emgarten
    Member

    This would still be useful, however we have not heard a lot of feedback on this so far.

  8. removed their assignment
    on Feb 14, 2018
  9. ghost added
    Status:Inactive
    on Sep 1, 2022
  10. added
    Priority:3
    and removed on Apr 3, 2024
  11. dotnet-policy-service commented on Mar 9, 2026

    @dotnet-policy-service
    Contributor

    Due to lack of recent activity, this issue has been marked as a candidate for icebox cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will add a Triage:NeedsTriageDiscussion label and lead to a triaging process.
    This process is part of the experimental Stale icebox issues cleanup we are currently trialing. Please share any feedback you might have in the linked issue.

  12. dotnet-policy-service commented on Mar 24, 2026

    @dotnet-policy-service
    Contributor

    This issue will now be closed since it had been marked Icebox cleanup candidate, but received no further activity in the past 14 days.

  13. removed this from the Backlog milestone on Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Functionality:RestoreIcebox cleanup candidatePriority:3Status:InactiveTriage:Investigate

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions