fsprojects / fsprojects/Paket

Microsoft.AspNetCore.Mvc and Copy Local on System Packages

Open
#3,448 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
F#
Stars
2.1k
Forks
528
Avg merge
1d 12m
Merged PRs (30d)
54

Description

The Microsoft.AspNetCore.Mvc package on nuget brings in many dependencies, and those dependencies bring in their own dependencies, most of which are listed under ".NETStandard 2.0". Many of those dependencies are system libraries and paket install adds references for the library using the system path (e.g. C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.7.1\Facades\System.AppContext.dll for "System.AppContext" if using .NET 4.7.1 on Windows 7).

The problem is that paket also sets "Copy Local" to true for those system libraries even though they are not referenced locally at all and are not copied to the output directory - and this causes Visual Studio to think the project needs to be rebuilt to copy the library into the output directory (despite it being a no-op). This means when building any project all of the projects it depends on must be rebuilt that reference any of these system libraries with Copy Local set to true.

Example:

Project C depends on project B
Project B depends on project A
Project A has one of these system libraries (e.g. System.AppContext.dll) referenced and Copy Local set to true.

Now right-click->Build on Project C will cause all the projects to be rebuilt even if project A and B had just been built.

I know the Copy Local setting is what causes Visual Studio to perform the rebuild by setting the "MSBuild project build output verbosity" to "Diagnostic" under Visual Studio->Tools->Options->Projects and Solutions.

Setting Copy Local to false would possibly fix the issue but must be done on every single system library package explicitly (which for Microsoft.AspNetCore.Mvc is a lot of transitive dependencies - a pain to maintain).

AspNetCore.Mvc and paket are both very popular and I find it hard to believe everyone is being forced to rebuild all projects that depend on a project that depends on AspNetCore.Mvc due to this issue, is there something I am missing here?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file, test, or entry point is named. Start by reproducing the Microsoft.AspNetCore.Mvc dependency graph on .NET Framework 4.7.1, then trace Paket's generated project references and Copy Local settings; done means the unnecessary rebuild behavior is covered by a focused regression test.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.