diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs b/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs index b4e3510a1..d0160a223 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs @@ -130,6 +130,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules private Func> CopyToOutputFilesTransformExecute => (compilerOptions, projectDirectory) => CopyToOutputFilesTransform.Transform(GetCopyToOutputIncludeContext(compilerOptions, projectDirectory)); + + private readonly string[] DefaultEmptyExcludeOption = new string[0]; private readonly ProjectPropertyGroupElement _configurationPropertyGroup; private readonly ProjectItemGroupElement _configurationItemGroup; @@ -328,7 +330,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules "compile", new JObject(), ProjectFilesCollection.DefaultCompileBuiltInPatterns, - ProjectFilesCollection.DefaultBuiltInExcludePatterns); + DefaultEmptyExcludeOption); } private IncludeContext GetEmbedIncludeContext(CommonCompilerOptions compilerOptions, string projectDirectory) @@ -340,7 +342,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules "embed", new JObject(), ProjectFilesCollection.DefaultResourcesBuiltInPatterns, - ProjectFilesCollection.DefaultBuiltInExcludePatterns); + DefaultEmptyExcludeOption); } private IncludeContext GetCopyToOutputIncludeContext(CommonCompilerOptions compilerOptions, string projectDirectory) diff --git a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateBuildOptions.cs b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateBuildOptions.cs index 122231849..0e9fffe6f 100644 --- a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateBuildOptions.cs +++ b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateBuildOptions.cs @@ -58,9 +58,9 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests mockProj.Items.Count().Should().Be(2); mockProj.Items.First(i => i.ItemType == "Compile").Include.Should().Be(@"**\*.cs"); - mockProj.Items.First(i => i.ItemType == "Compile").Exclude.Should().Be(@"bin\**;obj\**;**\*.xproj;packages\**"); + mockProj.Items.First(i => i.ItemType == "Compile").Exclude.Should().BeEmpty(); mockProj.Items.First(i => i.ItemType == "EmbeddedResource").Include.Should().Be(@"compiler\resources\**\*;**\*.resx"); - mockProj.Items.First(i => i.ItemType == "EmbeddedResource").Exclude.Should().Be(@"bin\**;obj\**;**\*.xproj;packages\**"); + mockProj.Items.First(i => i.ItemType == "EmbeddedResource").Exclude.Should().BeEmpty(); } [Fact]