From c8d553593c889d163f77e58d5bf80a28e5449dde Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Thu, 12 May 2022 14:33:21 +0200 Subject: [PATCH 1/5] Set DebugType and DebugSymbols after SDK import It's fairly common for repositories to set a default DebugType and/or DebugSymbols setting in their Directory.Build.props file. As an example, Arcade does that which impacts every repository in the .NET stack. The NoTargets SDK should overwrite these default settings (including the Microsoft.NET.Sdk setting) as the project clearly doesn't produce a symbol. Setting in the props file to allow a project to overwrite the setting if it explicitly wants to do so. --- src/NoTargets/Sdk/Sdk.props | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/NoTargets/Sdk/Sdk.props b/src/NoTargets/Sdk/Sdk.props index 833b3531..faea0c21 100644 --- a/src/NoTargets/Sdk/Sdk.props +++ b/src/NoTargets/Sdk/Sdk.props @@ -53,10 +53,6 @@ false false - - None - false - true @@ -76,6 +72,12 @@ + + + None + false + + From c40862a2a87021133b953678ab4abf88a5a888f5 Mon Sep 17 00:00:00 2001 From: Jeff Kluge Date: Thu, 19 May 2022 10:04:03 -0400 Subject: [PATCH 2/5] Move logic to targets and update test --- src/NoTargets.UnitTests/NoTargetsTests.cs | 42 +++++++++++++++-------- src/NoTargets/Sdk/Sdk.props | 6 ---- src/NoTargets/Sdk/Sdk.targets | 35 +++++++++---------- 3 files changed, 44 insertions(+), 39 deletions(-) diff --git a/src/NoTargets.UnitTests/NoTargetsTests.cs b/src/NoTargets.UnitTests/NoTargetsTests.cs index 214e68b4..9aca523f 100644 --- a/src/NoTargets.UnitTests/NoTargetsTests.cs +++ b/src/NoTargets.UnitTests/NoTargetsTests.cs @@ -155,23 +155,37 @@ public void ProjectsCanDependOnNoTargetsProjects() } [Theory] - [InlineData("DisableImplicitFrameworkReferences", "true")] - [InlineData("EnableDefaultCompileItems", "false")] - [InlineData("EnableDefaultEmbeddedResourceItems", "false")] - [InlineData("GenerateAssemblyInfo", "false")] - [InlineData("GenerateMSBuildEditorConfigFile", "false")] - [InlineData("IncludeBuildOutput", "false")] - [InlineData("ProduceReferenceAssembly", "false")] - [InlineData("SkipCopyBuildProduct", "true")] - [InlineData("AutomaticallyUseReferenceAssemblyPackages", "false")] - [InlineData("NoCompilerStandardLib", "false")] - [InlineData("DebugType", "None")] - [InlineData("DebugSymbols", "false")] - [InlineData("DisableFastUpToDateCheck", "true")] - public void PropertiesHaveExpectedValues(string propertyName, string expectedValue) + [InlineData("AutomaticallyUseReferenceAssemblyPackages", "true", "true")] + [InlineData("AutomaticallyUseReferenceAssemblyPackages", null, "false")] + [InlineData("DebugSymbols", "true", "false")] + [InlineData("DebugSymbols", null, "false")] + [InlineData("DebugType", "Full", "None")] + [InlineData("DebugType", null, "None")] + [InlineData("DisableFastUpToDateCheck", "false", "false")] + [InlineData("DisableFastUpToDateCheck", null, "true")] + [InlineData("DisableImplicitFrameworkReferences", "false", "false")] + [InlineData("DisableImplicitFrameworkReferences", null, "true")] + [InlineData("EnableDefaultCompileItems", "true", "true")] + [InlineData("EnableDefaultCompileItems", null, "false")] + [InlineData("EnableDefaultEmbeddedResourceItems", "true", "true")] + [InlineData("EnableDefaultEmbeddedResourceItems", null, "false")] + [InlineData("GenerateAssemblyInfo", "true", "true")] + [InlineData("GenerateAssemblyInfo", null, "false")] + [InlineData("GenerateMSBuildEditorConfigFile", "true", "true")] + [InlineData("GenerateMSBuildEditorConfigFile", null, "false")] + [InlineData("IncludeBuildOutput", "true", "true")] + [InlineData("IncludeBuildOutput", null, "false")] + [InlineData("NoCompilerStandardLib", "true", "true")] + [InlineData("NoCompilerStandardLib", null, "false")] + [InlineData("ProduceReferenceAssembly", "true", "true")] + [InlineData("ProduceReferenceAssembly", null, "false")] + [InlineData("SkipCopyBuildProduct", "false", "false")] + [InlineData("SkipCopyBuildProduct", null, "true")] + public void PropertiesHaveExpectedValues(string propertyName, string value, string expectedValue) { ProjectCreator.Templates.NoTargetsProject( path: GetTempFileWithExtension(".csproj")) + .Property(propertyName, value) .Save() .TryGetPropertyValue(propertyName, out string actualValue); diff --git a/src/NoTargets/Sdk/Sdk.props b/src/NoTargets/Sdk/Sdk.props index faea0c21..20d2b2c1 100644 --- a/src/NoTargets/Sdk/Sdk.props +++ b/src/NoTargets/Sdk/Sdk.props @@ -72,12 +72,6 @@ - - - None - false - - diff --git a/src/NoTargets/Sdk/Sdk.targets b/src/NoTargets/Sdk/Sdk.targets index dbc8809c..793725fd 100644 --- a/src/NoTargets/Sdk/Sdk.targets +++ b/src/NoTargets/Sdk/Sdk.targets @@ -29,25 +29,7 @@ - - false - - - - - - - - - - - - - - - + BuildOnlySettings; PrepareForBuild; @@ -59,8 +41,23 @@ IncrementalClean; PostBuildEvent + + + None + false + + + false + + + + + + + +