diff --git a/TestAssets/TestProjects/EndToEndTestApp/defaultresource.resx b/TestAssets/TestProjects/EndToEndTestApp/defaultresource.resx new file mode 100644 index 000000000..8db59de8e --- /dev/null +++ b/TestAssets/TestProjects/EndToEndTestApp/defaultresource.resx @@ -0,0 +1,4 @@ + + +Some content + \ No newline at end of file diff --git a/src/Microsoft.DotNet.ProjectModel/Files/IncludeContext.cs b/src/Microsoft.DotNet.ProjectModel/Files/IncludeContext.cs index c7b6150ec..39661bf1d 100644 --- a/src/Microsoft.DotNet.ProjectModel/Files/IncludeContext.cs +++ b/src/Microsoft.DotNet.ProjectModel/Files/IncludeContext.cs @@ -62,18 +62,8 @@ namespace Microsoft.DotNet.ProjectModel.Files BuiltInsInclude = CreateCollection( sourceBasePath, "include", ExtractValues(builtIns.Value("include")), literalPath: false); - if (defaultBuiltInInclude != null && !BuiltInsInclude.Any()) - { - BuiltInsInclude = defaultBuiltInInclude.ToList(); - } - BuiltInsExclude = CreateCollection( sourceBasePath, "exclude", ExtractValues(builtIns.Value("exclude")), literalPath: false); - - if (defaultBuiltInExclude != null && !BuiltInsExclude.Any()) - { - BuiltInsExclude = defaultBuiltInExclude.ToList(); - } } var mappings = token.Value("mappings") as JObject; @@ -94,6 +84,18 @@ namespace Microsoft.DotNet.ProjectModel.Files } } } + + if (defaultBuiltInInclude != null && + (BuiltInsInclude == null || !BuiltInsInclude.Any())) + { + BuiltInsInclude = defaultBuiltInInclude.ToList(); + } + + if (defaultBuiltInExclude != null && + (BuiltInsExclude == null || !BuiltInsExclude.Any())) + { + BuiltInsExclude = defaultBuiltInExclude.ToList(); + } } public string SourceBasePath { get; } diff --git a/test/Microsoft.DotNet.ProjectModel.Tests/GivenThatIWantToCreateIncludeEntriesFromJson.cs b/test/Microsoft.DotNet.ProjectModel.Tests/GivenThatIWantToCreateIncludeEntriesFromJson.cs index 58765ba23..5f6bd787c 100644 --- a/test/Microsoft.DotNet.ProjectModel.Tests/GivenThatIWantToCreateIncludeEntriesFromJson.cs +++ b/test/Microsoft.DotNet.ProjectModel.Tests/GivenThatIWantToCreateIncludeEntriesFromJson.cs @@ -62,7 +62,7 @@ namespace Microsoft.DotNet.ProjectModel.Tests 'buildOptions': { 'compile': { 'includeFiles': [ 'files/file1.cs', 'files/file2.cs' ], - 'exclude': 'files/*ex.cs' + 'exclude': '**/*.cs' } }}"); diff --git a/test/dotnet-compile.Tests/CompilerTests.cs b/test/dotnet-compile.Tests/CompilerTests.cs index d6f1792fb..c2e817dc5 100644 --- a/test/dotnet-compile.Tests/CompilerTests.cs +++ b/test/dotnet-compile.Tests/CompilerTests.cs @@ -166,6 +166,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests var objDirInfo = new DirectoryInfo(Path.Combine(root, "obj", "Debug", DefaultFramework)); objDirInfo.Should().HaveFile("EndToEndTestApp.resource1.resources"); objDirInfo.Should().HaveFile("myresource.resources"); + objDirInfo.Should().HaveFile("EndToEndTestApp.defaultresource.resources"); } [Fact]