Home: Targets not imported from dependency of a package reference

Created on 20 Nov 2017  路  5Comments  路  Source: NuGet/Home

_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.

 |_ 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_

ByDesign PackageReference

All 5 comments

_From @Pilchie on November 20, 2017 16:24_

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

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

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.

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.

closing as by design.

Was this page helpful?
0 / 5 - 0 ratings