diff --git a/readme.md b/readme.md
index 368f9ad3..7046b22d 100644
--- a/readme.md
+++ b/readme.md
@@ -230,7 +230,8 @@ Whether items are packed by default or not is controlled by properties named aft
| PackBuildOutput | true |
| PackReadme | true |
| PackSymbols | true if PackBuildOutput=true (*) |
-| PackDependencies| empty (**) |
+| PackSatelliteDlls | true if PackBuildOutput=true (**) |
+| PackDependencies| empty (***) |
| PackFrameworkReferences | true if PackFolder=lib, false if PackDependencies=false |
| PackProjectReferences | true |
@@ -239,7 +240,10 @@ Whether items are packed by default or not is controlled by properties named aft
\* Back in the day, PDBs were Windows-only and fat files. Nowadays, portable PDBs
(the new default) are lightweight and can even be embedded. Combined with [SourceLink](https://github.com/dotnet/sourcelink), including them in the package (either standalone or embeded) provides the best experience for your users, so it's the default.
-\** In some scenarios, you might want to turn off packing behavior for all PackageReference and FrameworkReferences alike. Setting PackDependencies=false achieves that.
+\** Satellite resources can come from the main project or from dependencies, if those PackageReferences
+ have `PrivateAssets=all`.
+
+\*** In some scenarios, you might want to turn off packing behavior for all PackageReference and FrameworkReferences alike. Setting PackDependencies=false achieves that.
The various supported item inference are surfaced as `` items, which are ultimately evaluated together with the metadata for the individual items. These make the package inference candidates. You can also provide an exclude expression for that evaluation so that certain items are excluded by default, even if every other item of the same type is included. For example, to pack all `Content` items, except those in the `docs` folder, you can simply update the inference item like so:
diff --git a/src/NuGetizer.Tasks/NuGetizer.Inference.targets b/src/NuGetizer.Tasks/NuGetizer.Inference.targets
index 9a6a7e93..6c1abf83 100644
--- a/src/NuGetizer.Tasks/NuGetizer.Inference.targets
+++ b/src/NuGetizer.Tasks/NuGetizer.Inference.targets
@@ -22,11 +22,14 @@ Copyright (c) .NET Foundation. All rights reserved.
true
-
+
true
-
+
+
+ true
+
true
@@ -187,7 +190,7 @@ Copyright (c) .NET Foundation. All rights reserved.
_SetPackTargetFramework;
InferPackageContents
-
+
-
+ PackagePath="%(Content.Link)"
+ Condition="%(Content.Identity) == '$(PackageIcon)' or %(Content.Link) == '$(PackageIcon)'" />
-
+
%(PackInference.PackExclude)
@@ -295,7 +298,7 @@ Copyright (c) .NET Foundation. All rights reserved.
@(_PackageIcon -> '%(Filename)')
@(_PackageIcon -> '%(Extension)')
-
+
<_ExistingIcon Include="@(None -> WithMetadataValue('Filename', '$(PackageReadmeFilename)'))" />
@@ -308,7 +311,7 @@ Copyright (c) .NET Foundation. All rights reserved.
PackagePath="%(Filename)%(Extension)"
Condition="'%(Extension)' == '$(PackageReadmeExtension)'" />
-
+
true
@@ -348,7 +351,8 @@ Copyright (c) .NET Foundation. All rights reserved.
.NETFramework, the desktop WinFX.targets are imported which don't have the fix, so we need to
do it "the old way" for this particular output group -->
<_SatelliteDllsProjectOutputGroupOutput Include="@(SatelliteDllsProjectOutputGroupOutput)"
- FinalOutputPath="%(FullPath)" />
+ FinalOutputPath="%(FullPath)"
+ Condition="'$(PackSatelliteDlls)' != 'false'"/>
<_InferredProjectOutput Include="@(BuiltProjectOutputGroupOutput -> '%(FinalOutputPath)');
@(BuiltProjectOutputGroupKeyOutput -> '%(FinalOutputPath)');
@@ -359,7 +363,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<_InferredProjectOutput Include="@(DebugSymbolsProjectOutputGroupOutput -> '%(FinalOutputPath)')"
- Condition="'$(PackSymbols)' != 'false'">
+ Condition="'$(PackSymbols)' != 'false'">
$(PackFolder)
$(BuildOutputFrameworkSpecific)
@@ -367,6 +371,15 @@ Copyright (c) .NET Foundation. All rights reserved.
<_InferredPackageFile Include="@(_InferredProjectOutput -> Distinct())" />
+
+
+ <_InferredPackageFile Include="@(ResourceCopyLocalItems)"
+ PackFolder="$(PackFolder)"
+ TargetPath="%(ResourceCopyLocalItems.DestinationSubPath)"
+ FrameworkSpecific="$(BuildOutputFrameworkSpecific)"
+ Condition="$(PrivatePackageReferenceIds.Contains(';%(ResourceCopyLocalItems.NuGetPackageId);'))" />
+
+
<_InferredPublishItem Include="@(PublishItemsOutputGroupOutputs -> '%(OutputPath)')" />
<_InferredPackageFile Include="@(_InferredPublishItem -> '%(FullPath)')">
@@ -446,8 +459,8 @@ Copyright (c) .NET Foundation. All rights reserved.
-
@@ -474,14 +487,23 @@ Copyright (c) .NET Foundation. All rights reserved.
PackageDependencies="@(PackageDependencies)">
+
+
+ <_PrivatePackageReference Include="@(PackageReference)" Condition="%(PackageReference.Pack) != 'false' and '%(PackageReference.PrivateAssets)' == 'all'" />
+ <_PrivatePackageReference Include="@(ImplicitPackageReference)" Condition="%(PackageReference.Pack) != 'false' and '%(PackageReference.PrivateAssets)' == 'all'" />
+
+
+ ;@(_PrivatePackageReference);
+
+
diff --git a/src/NuGetizer.Tests/given_packinference.cs b/src/NuGetizer.Tests/given_packinference.cs
index 97b637f7..11353c3f 100644
--- a/src/NuGetizer.Tests/given_packinference.cs
+++ b/src/NuGetizer.Tests/given_packinference.cs
@@ -595,5 +595,38 @@ public void when_direct_and_indirect_packagereference_then_packs_once()
Extension = ".dll",
}));
}
+
+ [Fact]
+ public void when_packing_dependencies_then_includes_satellite_resources_for_private_assets()
+ {
+ var result = Builder.BuildProject(
+ """
+
+
+ Exe
+ netstandard2.0
+ true
+ Latest
+
+
+
+
+
+
+ """, output: output);
+
+ result.AssertSuccess(output);
+
+ Assert.Contains(result.Items, item => item.Matches(new
+ {
+ PackagePath = "lib/netstandard2.0/es/Microsoft.CodeAnalysis.CSharp.resources.dll",
+ }));
+
+ Assert.Contains(result.Items, item => item.Matches(new
+ {
+ PackagePath = "lib/netstandard2.0/es/Microsoft.CodeAnalysis.resources.dll",
+ }));
+ }
+
}
}