diff --git a/src/NuGetizer.Tasks/NuGetizer.Inference.targets b/src/NuGetizer.Tasks/NuGetizer.Inference.targets index 405158cf..91eb7e7f 100644 --- a/src/NuGetizer.Tasks/NuGetizer.Inference.targets +++ b/src/NuGetizer.Tasks/NuGetizer.Inference.targets @@ -42,6 +42,8 @@ Copyright (c) .NET Foundation. All rights reserved. true true + + true <_OutputFullPath Condition="$([System.IO.Path]::IsPathRooted($(OutputPath)))">$(OutputPath) <_OutputFullPath Condition="'$(_OutputFullPath)' == ''">$(MSBuildProjectDirectory.TrimEnd('\'))\$(OutputPath) @@ -236,6 +238,28 @@ Copyright (c) .NET Foundation. All rights reserved. + + + + + <_PackageReadmeFilename Condition="'$(PackageReadmeFile)' != ''">$(PackageReadmeFile) + <_PackageReadmeFilename Condition="'$(PackageReadmeFile)' == ''">readme.md + + + + + + + %(PackInference.PackExclude) diff --git a/src/NuGetizer.Tests/given_a_packaging_project.cs b/src/NuGetizer.Tests/given_a_packaging_project.cs index f470d79a..55b2cfca 100644 --- a/src/NuGetizer.Tests/given_a_packaging_project.cs +++ b/src/NuGetizer.Tests/given_a_packaging_project.cs @@ -499,5 +499,62 @@ public void when_readme_custom_extension_specified_then_adds_metadata_and_conten Readme = "readme.txt", })); } + + [Fact] + public void when_packaging_project_then_none_items_pack_by_default() + { + var result = Builder.BuildProject(@" + + + Packer + netstandard2.0 + + true + +", + "GetPackageContents", output, + files: ("Packer.targets", @"")); + + result.AssertSuccess(output); + Assert.Contains(result.Items, item => item.Matches(new + { + Filename = "Packer", + Extension = ".targets", + PackFolder = "None", + })); + } + + [Fact] + public void when_packaging_project_with_none_item_then_packs_without_explicit_packnone() + { + var result = Builder.BuildProject(@" + + + MyPackage + netstandard2.0 + + + + + +", + "GetPackageContents", output, + files: [ + ("MyPackage.targets", @""), + ("tools\\install.ps1", @"# Install script") + ]); + + result.AssertSuccess(output); + Assert.Contains(result.Items, item => item.Matches(new + { + Filename = "MyPackage", + Extension = ".targets", + })); + Assert.Contains(result.Items, item => item.Matches(new + { + Filename = "install", + Extension = ".ps1", + })); + } } }