diff --git a/src/Build/NuGet.Build.Packaging.Tasks/NuGet.Build.Packaging.Inference.targets b/src/Build/NuGet.Build.Packaging.Tasks/NuGet.Build.Packaging.Inference.targets
index dca1d2f..5b25282 100644
--- a/src/Build/NuGet.Build.Packaging.Tasks/NuGet.Build.Packaging.Inference.targets
+++ b/src/Build/NuGet.Build.Packaging.Tasks/NuGet.Build.Packaging.Inference.targets
@@ -107,23 +107,23 @@ Copyright (c) .NET Foundation. All rights reserved.
<_InferredPackageFile Include="@(_ContentToInfer->'$(OutputPath)%(TargetPath)')"
- Condition="'%(_ContentToInfer.CopyToOutputDirectory)' != ''">
+ Condition="'%(_ContentToInfer.CopyToOutputDirectory)' != '' and '%(_ContentToInfer.CopyToOutputDirectory)' != 'Never'">
$(PrimaryOutputKind)
<_InferredPackageFile Include="@(_ContentToInfer->'%(FullPath)')"
- Condition="'%(_ContentToInfer.CopyToOutputDirectory)' == ''">
+ Condition="'%(_ContentToInfer.CopyToOutputDirectory)' == '' or '%(_ContentToInfer.CopyToOutputDirectory)' == 'Never'">
Content
<_InferredPackageFile Include="@(_NoneToInfer->'$(OutputPath)%(TargetPath)')"
- Condition="'%(_NoneToInfer.CopyToOutputDirectory)' != ''">
+ Condition="'%(_NoneToInfer.CopyToOutputDirectory)' != '' and '%(_NoneToInfer.CopyToOutputDirectory)' != 'Never'">
$(PrimaryOutputKind)
<_InferredPackageFile Include="@(_NoneToInfer->'%(FullPath)')"
- Condition="'%(_NoneToInfer.CopyToOutputDirectory)' == ''">
+ Condition="'%(_NoneToInfer.CopyToOutputDirectory)' == '' or '%(_NoneToInfer.CopyToOutputDirectory)' == 'Never'">
None
diff --git a/src/Build/NuGet.Build.Packaging.Tests/Builder.NuGetizer.cs b/src/Build/NuGet.Build.Packaging.Tests/Builder.NuGetizer.cs
index 10921cc..6d69337 100644
--- a/src/Build/NuGet.Build.Packaging.Tests/Builder.NuGetizer.cs
+++ b/src/Build/NuGet.Build.Packaging.Tests/Builder.NuGetizer.cs
@@ -62,20 +62,23 @@ public static TargetResult BuildScenario(string scenarioName, object properties
buildProps[nameof(ThisAssembly.Project.Properties.NuGetRestoreTargets)] = ThisAssembly.Project.Properties.NuGetRestoreTargets;
buildProps[nameof(ThisAssembly.Project.Properties.NuGetTargets)] = ThisAssembly.Project.Properties.NuGetTargets;
- return new TargetResult(Build(projectOrSolution, target,
+ return new TargetResult(projectOrSolution, Build(projectOrSolution, target,
properties: buildProps,
logger: logger), target, logger);
}
public class TargetResult : ITargetResult
{
- public TargetResult(BuildResult result, string target, TestOutputLogger logger)
+ public TargetResult(string projectOrSolutionFile, BuildResult result, string target, TestOutputLogger logger)
{
+ ProjectOrSolutionFile = projectOrSolutionFile;
BuildResult = result;
Target = target;
Logger = logger;
}
+ public string ProjectOrSolutionFile { get; private set; }
+
public BuildResult BuildResult { get; private set; }
public TestOutputLogger Logger { get; private set; }
diff --git a/src/Build/NuGet.Build.Packaging.Tests/NuGet.Build.Packaging.Tests.csproj b/src/Build/NuGet.Build.Packaging.Tests/NuGet.Build.Packaging.Tests.csproj
index 30c3e36..bc00618 100644
--- a/src/Build/NuGet.Build.Packaging.Tests/NuGet.Build.Packaging.Tests.csproj
+++ b/src/Build/NuGet.Build.Packaging.Tests/NuGet.Build.Packaging.Tests.csproj
@@ -39,5 +39,8 @@
PreserveNewest
+
+
+
\ No newline at end of file
diff --git a/src/Build/NuGet.Build.Packaging.Tests/given_a_library_with_content.cs b/src/Build/NuGet.Build.Packaging.Tests/given_a_library_with_content.cs
index d107a27..a4af60e 100644
--- a/src/Build/NuGet.Build.Packaging.Tests/given_a_library_with_content.cs
+++ b/src/Build/NuGet.Build.Packaging.Tests/given_a_library_with_content.cs
@@ -1,4 +1,5 @@
-using System.Linq;
+using System.IO;
+using System.Linq;
using Microsoft.Build.Execution;
using NuGet.Build.Packaging.Properties;
using Xunit;
@@ -136,6 +137,24 @@ public void content_no_copy_is_content_files_anylang_tfm_specific()
}));
}
+ [Fact]
+ public void content_no_copy_is_included_from_source()
+ {
+ var result = Builder.BuildScenario(nameof(given_a_library_with_content), new
+ {
+ PackageId = "ContentPackage"
+ });
+
+ result.AssertSuccess(output);
+
+ var sourcePath = Path.Combine(Path.GetDirectoryName(result.ProjectOrSolutionFile), "content-with-kind.txt");
+
+ Assert.Contains(result.Items, item => item.Matches(new
+ {
+ FullPath = sourcePath,
+ }));
+ }
+
[Fact]
public void content_no_copy_with_contentFiles_dir_fails()
{
@@ -495,6 +514,24 @@ public void none_with_kind_is_included_as_kind()
}));
}
+ [Fact]
+ public void none_with_kind_is_included_from_source()
+ {
+ var result = Builder.BuildScenario(nameof(given_a_library_with_content), new
+ {
+ PackageId = "ContentPackage"
+ });
+
+ result.AssertSuccess(output);
+
+ var sourcePath = Path.Combine(Path.GetDirectoryName(result.ProjectOrSolutionFile), "none-with-kind.txt");
+
+ Assert.Contains(result.Items, item => item.Matches(new
+ {
+ FullPath = sourcePath,
+ }));
+ }
+
[Fact]
public void none_no_kind_is_included__as_none()
{