diff --git a/readme.md b/readme.md
index e8ca9bfb..85f2b2ad 100644
--- a/readme.md
+++ b/readme.md
@@ -227,6 +227,7 @@ When an item specifies *FrameworkSpecific=true*, the project's target framework
|------------------|-------------------|
| content (*) | true |
| lib | true |
+| ref | true |
| dependency (**) | true |
| frameworkReference (**) | true |
| build | false |
@@ -236,7 +237,7 @@ When an item specifies *FrameworkSpecific=true*, the project's target framework
\** *dependency* and *frameworkReference* are pseudo folders containing the package references and framework (`` 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 91eb7e7f..a5badace 100644
--- a/src/NuGetizer.Tasks/NuGetizer.Inference.targets
+++ b/src/NuGetizer.Tasks/NuGetizer.Inference.targets
@@ -36,6 +36,9 @@ Copyright (c) .NET Foundation. All rights reserved.
true
+
+ true
+
false
@@ -402,6 +405,14 @@ Copyright (c) .NET Foundation. All rights reserved.
<_InferredPackageFile Include="@(_InferredProjectOutput -> Distinct())" />
+
+
+ <_InferredPackageFile Include="$(TargetRefPath)">
+ Ref
+ true
+
+
+
<_InferredPackageFile Include="@(ResourceCopyLocalItems)"
diff --git a/src/NuGetizer.Tasks/NuGetizer.props b/src/NuGetizer.Tasks/NuGetizer.props
index 83f93078..43ee1399 100644
--- a/src/NuGetizer.Tasks/NuGetizer.props
+++ b/src/NuGetizer.Tasks/NuGetizer.props
@@ -134,6 +134,7 @@ Copyright (c) .NET Foundation. All rights reserved.
ref
+ true
analyzers
diff --git a/src/NuGetizer.Tests/InlineProjectTests.cs b/src/NuGetizer.Tests/InlineProjectTests.cs
index 6d43a63f..8e6eb499 100644
--- a/src/NuGetizer.Tests/InlineProjectTests.cs
+++ b/src/NuGetizer.Tests/InlineProjectTests.cs
@@ -1097,5 +1097,148 @@ public void when_dependency_is_development_dependency_then_can_explicitly_pack_i
Assert.Equal("ThisAssembly.Constants", manifest.Metadata.DependencyGroups.First().Packages.First().Id);
}
}
+
+ [Fact]
+ public void when_produce_reference_assembly_then_includes_ref_assembly()
+ {
+ var result = Builder.BuildProject(
+ """
+
+
+ net8.0
+ true
+
+
+ """, output: output);
+
+ result.AssertSuccess(output);
+
+ // Should have the main assembly in lib
+ Assert.Contains(result.Items, item => item.Matches(new
+ {
+ Extension = ".dll",
+ PackFolder = PackFolderKind.Lib
+ }));
+
+ // Should also have the reference assembly in ref
+ Assert.Contains(result.Items, item => item.Matches(new
+ {
+ Extension = ".dll",
+ PackFolder = PackFolderKind.Ref
+ }));
+ }
+
+ [Fact]
+ public void when_produce_reference_assembly_false_then_does_not_include_ref_assembly()
+ {
+ var result = Builder.BuildProject(
+ """
+
+
+ net8.0
+ false
+
+
+ """, output: output);
+
+ result.AssertSuccess(output);
+
+ // Should have the main assembly in lib
+ Assert.Contains(result.Items, item => item.Matches(new
+ {
+ Extension = ".dll",
+ PackFolder = PackFolderKind.Lib
+ }));
+
+ // Should NOT have a reference assembly in ref
+ Assert.DoesNotContain(result.Items, item => item.Matches(new
+ {
+ PackFolder = PackFolderKind.Ref
+ }));
+ }
+
+ [Fact]
+ public void when_produce_reference_assembly_but_pack_build_output_false_then_does_not_include_ref_assembly()
+ {
+ var result = Builder.BuildProject(
+ """
+
+
+ net8.0
+ true
+ false
+
+
+ """, output: output);
+
+ result.AssertSuccess(output);
+
+ // Should NOT have the main assembly in lib
+ Assert.DoesNotContain(result.Items, item => item.Matches(new
+ {
+ Extension = ".dll",
+ PackFolder = PackFolderKind.Lib
+ }));
+
+ // Should NOT have a reference assembly in ref either
+ Assert.DoesNotContain(result.Items, item => item.Matches(new
+ {
+ PackFolder = PackFolderKind.Ref
+ }));
+ }
+
+ [Fact]
+ public void when_produce_reference_assembly_can_opt_out_with_pack_ref_assembly_false()
+ {
+ var result = Builder.BuildProject(
+ """
+
+
+ net8.0
+ true
+ false
+
+
+ """, output: output);
+
+ result.AssertSuccess(output);
+
+ // Should have the main assembly in lib
+ Assert.Contains(result.Items, item => item.Matches(new
+ {
+ Extension = ".dll",
+ PackFolder = PackFolderKind.Lib
+ }));
+
+ // Should NOT have a reference assembly in ref
+ Assert.DoesNotContain(result.Items, item => item.Matches(new
+ {
+ PackFolder = PackFolderKind.Ref
+ }));
+ }
+
+ [Fact]
+ public void when_produce_reference_assembly_then_ref_assembly_is_framework_specific()
+ {
+ var result = Builder.BuildProject(
+ """
+
+
+ net8.0
+ true
+ true
+
+
+ """, output: output);
+
+ result.AssertSuccess(output);
+
+ // The ref assembly should have a package path that includes the TFM
+ Assert.Contains(result.Items, item => item.Matches(new
+ {
+ PackFolder = PackFolderKind.Ref,
+ PackagePath = "ref/net8.0/scenario.dll"
+ }));
+ }
}
}