Skip to content

Targets not imported from dependency of a package reference #6206

Closed

Description

@emgarten

From @bhugot on November 17, 2017 23:11

Hello,

If you create a package that, as a dependency, contains a target, the targets are not used by the project by referencing it.

Project 
 |_ NugetA
     |_ NugetB
        |_ build.targets

If we install NugetB on Project, the targets are applied.

How to solve this problem because I do not want to apply the targets of the dependency.

Thanks

Copied from original issue: dotnet/project-system#2973

Activity

  1. emgarten commented on Nov 20, 2017

    @emgarten
    MemberAuthor

    From @Pilchie on November 20, 2017 16:24

    @rrelyea @emgarten - this sounds like it should be moved to nuget/Home?

  2. emgarten commented on Nov 20, 2017

    @emgarten
    MemberAuthor

    @bhugot can you share the reference in NuGetA's nuspec to NuGetB, does it have exclude=build?

  3. bhugot commented on Nov 21, 2017

    @bhugot

    Hello, i found the problem I am using the nuget explorer and didn't see some hidden property in generated nuspec.
    It's sad that we can't exclude a targets from the project A build but include it for the project who use nuget of project A. need to use nuspec to achieve this.

  4. emgarten commented on Nov 21, 2017

    @emgarten
    MemberAuthor

    It's sad that we can't exclude a targets from the project A build but include it for the project who use nuget of project A. need to use nuspec to achieve this.

    You can do this by setting PrivateAssets=None on the project reference. The nuspec captures the state of the project. In your scenario if all packages were projects this would not flow either.

  5. jainaashish commented on Jan 10, 2018

    @jainaashish

    closing as by design.

  6. added this to the 4.6 milestone on Jan 10, 2018
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

    Resolution:ByDesignStyle:PackageReference

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions