Skip to content

Allow package authors to define build assets which work transitively (using buildTransitive assets group) #6091

Closed

Description

@nkolev92

Consider changing the default transitive flowing behavior of the build assets.
SPEC

Related #6388

Related to #6206, although at pack time likely

Activity

  1. self-assigned this
    on Oct 24, 2017
  2. added this to the Backlog milestone on Oct 24, 2017
  3. added
    Priority:1
    on Oct 24, 2017
  4. mungojam commented on Nov 17, 2017

    @mungojam

    Feels related: this discussion

    In summary, having a way to include compile in private assets as default unless project/package needs to expose it, i.e.: PrivateAssets="compile;contentfiles;analyzers;build" (I checked what the implicit default is and it seems to be contentfiles;analyzers;build).

  5. nkolev92 commented on Nov 17, 2017

    @nkolev92
    MemberAuthor

    @mungojam

    I think #4125 covers what you're articulating.

    We are considering bringing developmentDependency back, which should allow the author of PackageA to affect the default flowing behavior for the dependencies of PackageA.

    PrivateAssets is basically a transitive flow control for the consumer of the package, while DevelopmentDependency would be a transitive flow control for the author the package.

  6. mungojam commented on Nov 17, 2017

    @mungojam

    @nkolev92 It's similar to development dependency but more general. If I am using a package like Newtonsoft.Json in my package, I don't want it to be exported to consumers of my package unless I explicitly need to (or I'm creating a meta-package). It's more like a runtimeDependency rather than an apiDependency.

    I wouldn't want Newtonsoft.Json to be part of the contract of my package because some day I might move to a different Json library.

    It feels like this should be the default somehow.

  7. mungojam commented on Nov 17, 2017

    @mungojam

    Just re-read the second bit of your comment. Perhaps I am mistaken, I haven't ever used DevelopmentDependency, but have assumed it is only for stopping dependencies going anywhere, i.e. PrivateAssets="All" which would be too extreme in my case as they are runtime dependencies that need to go up the chain and into bin folder.

  8. changed the title [-]Consider changing the default transitive flowing behavior of the build assets[/-] [+]Change the default behavior of build dependency asset to transitive[/+] on Nov 28, 2017
  9. removed
    Priority:1
    on Dec 4, 2017
  10. natemcmaster commented on Jan 11, 2018

    @natemcmaster

    I think this is a good feature, worth pursuing, and one I wish we had from the beginning.

    But since its a breaking change, my knee-jerk reaction to reading the spec on this is that it could cause compatibility issues with existing packages, like some of the ones we shipped in ASP.NET Core 1.0. They contain build props/targets written under the assumption that they only apply to one project file. For example, some using Microsoft.Extensions.Configuration.UserSecrets 1.x would get new build warnings. It may also cause some Visual Studio issues where it uses MSBuild properties set via PackageReference to change behavior (a feature I'm currently working on.)

    The spec currently says:

    Since this is a breaking change, we need to provide a switch for consumers to change back the dependency asset behavior.

    Can you comment more on current thinking for this open question?

    Related question: how would a user know they need to change back? New build errors are actually good. They force a user to figure out what changed. The more pernicious bugs will happen because some builds will continue working without failures/warnings, but the output of the build will change. i.e. new files in output, different build properties will be set, etc. How would we expect a user to figure out what caused these behavior changes?

    cc @davidfowl

  11. 37 remaining items

  12. terrajobst commented on Jan 25, 2019

    @terrajobst

    My general feel for the the design of .props and .targets ingestion is that this should be considered an escape hatch for advanced package authoring so that cases like @onovotny where conventions don't work the developer has a 100% control. For this to work, they build scripts must flow across P2P, so I'm highly supportive of this change.

    As a side note, have you opened this issue against dotnet/sdk? I think they would be interested in this feedback on the wpf/winforms problems.

    Yes, we should discuss this more but this problem doesn't have good solutions IMHO. It either requires making WPF/WinForms a different TFM, inventing some new profile mechanism, or generalizing RIDs so that people can vary API surface based on them. Personally, I think Oren's scenario where a developer needs to inject different code based on whether the project references WPF/WinForms is rare -- and I think are also likely indicators of bugs in the library. In Oren's case the library depends on UI controls. This hasn't bitten anyone in .NET Framework because everything is there, all the time. But technically this was always a very clear layer violation.

  13. xen2 commented on Jan 27, 2019

    @xen2

    Great, we can finally get rid of those custom PrivateAssets!
    Will this make it only in VS 2019 or also in a VS 2017 update?

  14. jainaashish commented on Jan 28, 2019

    @jainaashish

    For now, this will only be in VS 2019 (starting with VS 2019 preview3)

  15. ericstj commented on Apr 25, 2019

    @ericstj

    Curious if you considered a bit in the nuspec metadata to indicate this behavior rather than forcing folks to copy their files into different directories. Your spec calls out that folks essentially need to duplicate the buildTransitive folder anyhow to work with old clients/packages.config. Seems to me like its a non-goal to enable folks to have different content in build and buildTransitive but giving them this option opens up that possibility.

  16. nkolev92 commented on Apr 25, 2019

    @nkolev92
    MemberAuthor

    @ericstj

    We did consider the nuspec option, but it would've led to an unenvious pack experience.

    Having both build/buildTransitive imported was a non-goal at that point.

  17. ericstj commented on Apr 25, 2019

    @ericstj

    What does "unenvious pack experience" mean? If you can point me to that discussion I'll read up rather than rehash stuff here.

  18. nkolev92 commented on Apr 25, 2019

    @nkolev92
    MemberAuthor

    It would've been contentFiles like, where there is still no way to configure all the switches like language.
    The precedent with duplication played a role in the decision.

    Not sure if/where that write-up is.
    Not sure how much @jainaashish looks at GitHub these days to help with some pointers.

  19. jainaashish commented on Apr 26, 2019

    @jainaashish

    We indeed discussed multiple solutions while designing this feature and one such case was to introduce a flag in nuspec. All discussed solutions might still be there in Spec PR in Engineering private repo. But as far as i remember nuspec solution was not suitable for a) if you need both transitive and non-transitive build assets in a packae (which was a real usecase for some customers) and b) would not have worked for packages.config.

  20. changed the title [-]Allow package authors to define build assets transitive behavior[/-] [+]Allow package authors to define build assets which work transitively (using buildTransitive assets group)[/+] on Jan 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions