From 41db8424ff4eb4f9e04338a71535664d646e83f4 Mon Sep 17 00:00:00 2001 From: Erick Yondon Date: Thu, 8 Dec 2022 18:38:01 -0800 Subject: [PATCH] Add project2project scenario --- .../PrivateAssetIndepdentFromExcludeAsset.md | 53 ++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/proposed/2022/PrivateAssetIndepdentFromExcludeAsset.md b/proposed/2022/PrivateAssetIndepdentFromExcludeAsset.md index c2ea617ee..8b43f0284 100644 --- a/proposed/2022/PrivateAssetIndepdentFromExcludeAsset.md +++ b/proposed/2022/PrivateAssetIndepdentFromExcludeAsset.md @@ -23,7 +23,7 @@ We couldn't make this default experience because it'll break customers who rely The new ` PrivateAssetIndependent` property only affects pack operation (more specifically nuspec in nupkg file), but doesn't affect restore experience for current project so there would be no change in `project.assets.json` lock file. -Experience for parent consuming project would be affected by which asset from `compile, runtime, contentFiles, build, buildMultitargeting, buildTransitive, analyzers, native` are flowing into them. +Experience for parent consuming project would be affected by which asset from `compile, runtime, contentFiles, build, buildMultitargeting, buildTransitive, analyzers, native` are flowing into them for both `PackageReference` and `ProjectReference` consumptions. For the following table assume `PrivateAssetIndependent` is set `true` when creating package, iterating possible scenarios (not full list) for consuming parent project. @@ -34,6 +34,24 @@ For the following table assume `PrivateAssetIndependent` is set `true` when crea | build | Enable msbuild imports | Build fails due to property/target value change | | analyzers | Code analyzers work | n/a | +Here is brief summary for what would change for consuming `parent` project. + +Before change for given `asset`: +Include|Private|Flows transitively +--|--|-- +yes|yes|yes +yes|no|no +no|yes|no +no|no|no + +After change for given `asset`: +Include|Private|Flows transitively +--|--|-- +yes|yes|yes +yes|no|no +no|yes|yes +no|no|no + #### Examples ##### Case 1 for PackageReference @@ -49,6 +67,7 @@ Package reference in csproj file. +``` Before change nuspec file: @@ -103,6 +122,38 @@ After change nuspec file: ``` +##### Case for Project to Project reference + +Package reference in parent `ClassLibrary1` csproj file. + +```.net + + net7.0 + enable + enable + + + + + +``` + +```.net + + netstandard2.0 + beta + True + + + + + +``` + +Before change for `Microsoft.Windows.CsWin32.props` file in `build` asset doesn't flow to ClassLibrary1.csproj.nuget.g.props file in obj folder. + +After change for `Microsoft.Windows.CsWin32.props` file in `build` asset flow to ClassLibrary1.csproj.nuget.g.props file in obj folder. + ### Technical explanation We already have a [logic](hhttps://github.com/NuGet/NuGet.Client/blob/380415d812681ebf1c8aa0bc21533d4710514fc3/src/NuGet.Core/NuGet.Commands/CommandRunners/PackCommandRunner.cs#L577-L582) that combines `IncludeAssets/ExcludeAssets` options with `PrivateAssets`, we just change precedence on that logic depending on opt-in property.