Skip to content

Commit 9af7ea2

Browse files
authored
Set DebugType and DebugSymbols unconditionally (#360)
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.
1 parent 0167add commit 9af7ea2

File tree

5 files changed

+46
-39
lines changed

5 files changed

+46
-39
lines changed

azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ variables:
66
BuildConfiguration: 'Debug'
77
BuildPlatform: 'Any CPU'
88
DotNet3Version: '3.x'
9-
DotNet6Version: '6.x'
9+
DotNet6Version: '6.0.203'
1010
MSBuildArgs: '"/p:Platform=$(BuildPlatform)" "/p:Configuration=$(BuildConfiguration)" "/BinaryLogger:$(Build.SourcesDirectory)\$(ArtifactsDirectoryName)\msbuild.binlog"'
1111
SignType: 'Test'
1212

src/NoTargets.UnitTests/NoTargetsTests.cs

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -155,23 +155,37 @@ public void ProjectsCanDependOnNoTargetsProjects()
155155
}
156156

157157
[Theory]
158-
[InlineData("DisableImplicitFrameworkReferences", "true")]
159-
[InlineData("EnableDefaultCompileItems", "false")]
160-
[InlineData("EnableDefaultEmbeddedResourceItems", "false")]
161-
[InlineData("GenerateAssemblyInfo", "false")]
162-
[InlineData("GenerateMSBuildEditorConfigFile", "false")]
163-
[InlineData("IncludeBuildOutput", "false")]
164-
[InlineData("ProduceReferenceAssembly", "false")]
165-
[InlineData("SkipCopyBuildProduct", "true")]
166-
[InlineData("AutomaticallyUseReferenceAssemblyPackages", "false")]
167-
[InlineData("NoCompilerStandardLib", "false")]
168-
[InlineData("DebugType", "None")]
169-
[InlineData("DebugSymbols", "false")]
170-
[InlineData("DisableFastUpToDateCheck", "true")]
171-
public void PropertiesHaveExpectedValues(string propertyName, string expectedValue)
158+
[InlineData("AutomaticallyUseReferenceAssemblyPackages", "true", "true")]
159+
[InlineData("AutomaticallyUseReferenceAssemblyPackages", null, "false")]
160+
[InlineData("DebugSymbols", "true", "false")]
161+
[InlineData("DebugSymbols", null, "false")]
162+
[InlineData("DebugType", "Full", "None")]
163+
[InlineData("DebugType", null, "None")]
164+
[InlineData("DisableFastUpToDateCheck", "false", "false")]
165+
[InlineData("DisableFastUpToDateCheck", null, "true")]
166+
[InlineData("DisableImplicitFrameworkReferences", "false", "false")]
167+
[InlineData("DisableImplicitFrameworkReferences", null, "true")]
168+
[InlineData("EnableDefaultCompileItems", "true", "true")]
169+
[InlineData("EnableDefaultCompileItems", null, "false")]
170+
[InlineData("EnableDefaultEmbeddedResourceItems", "true", "true")]
171+
[InlineData("EnableDefaultEmbeddedResourceItems", null, "false")]
172+
[InlineData("GenerateAssemblyInfo", "true", "true")]
173+
[InlineData("GenerateAssemblyInfo", null, "false")]
174+
[InlineData("GenerateMSBuildEditorConfigFile", "true", "true")]
175+
[InlineData("GenerateMSBuildEditorConfigFile", null, "false")]
176+
[InlineData("IncludeBuildOutput", "true", "true")]
177+
[InlineData("IncludeBuildOutput", null, "false")]
178+
[InlineData("NoCompilerStandardLib", "true", "true")]
179+
[InlineData("NoCompilerStandardLib", null, "false")]
180+
[InlineData("ProduceReferenceAssembly", "true", "false")]
181+
[InlineData("ProduceReferenceAssembly", null, "false")]
182+
[InlineData("SkipCopyBuildProduct", "false", "false")]
183+
[InlineData("SkipCopyBuildProduct", null, "true")]
184+
public void PropertiesHaveExpectedValues(string propertyName, string value, string expectedValue)
172185
{
173186
ProjectCreator.Templates.NoTargetsProject(
174187
path: GetTempFileWithExtension(".csproj"))
188+
.Property(propertyName, value)
175189
.Save()
176190
.TryGetPropertyValue(propertyName, out string actualValue);
177191

src/NoTargets/Sdk/Sdk.props

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@
5353
<AutomaticallyUseReferenceAssemblyPackages Condition="'$(AutomaticallyUseReferenceAssemblyPackages)' == ''">false</AutomaticallyUseReferenceAssemblyPackages>
5454
<NoCompilerStandardLib Condition="'$(NoCompilerStandardLib)' == ''">false</NoCompilerStandardLib>
5555

56-
<!-- Indicate no symbols will be generated -->
57-
<DebugType Condition="'$(DebugType)' == ''">None</DebugType>
58-
<DebugSymbols Condition="'$(DebugSymbols)' == ''">false</DebugSymbols>
59-
6056
<!-- Disable Visual Studio's Fast Up-to-date Check and rely on MSBuild to determine -->
6157
<DisableFastUpToDateCheck Condition="'$(DisableFastUpToDateCheck)' == ''">true</DisableFastUpToDateCheck>
6258
</PropertyGroup>

src/NoTargets/Sdk/Sdk.targets

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,7 @@
2929
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" Condition=" '$(CommonTargetsPath)' == '' " />
3030

3131
<PropertyGroup>
32-
<!-- Don't emit a reference assembly -->
33-
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
34-
</PropertyGroup>
35-
36-
<ItemGroup>
37-
<IntermediateAssembly Remove="@(IntermediateAssembly)" />
38-
<IntermediateRefAssembly Remove="@(IntermediateRefAssembly)" />
39-
</ItemGroup>
40-
41-
<!-- Clear output group items which are read by the IDE and NuGet. -->
42-
<ItemGroup>
43-
<BuiltProjectOutputGroupKeyOutput Remove="@(BuiltProjectOutputGroupKeyOutput)" />
44-
<DebugSymbolsProjectOutputGroupOutput Remove="@(DebugSymbolsProjectOutputGroupOutput)" />
45-
</ItemGroup>
46-
47-
<PropertyGroup>
48-
<!--
49-
This property must be overridden to remove a few targets that compile assemblies
50-
-->
32+
<!-- This property must be overridden to remove a few targets that compile assemblies -->
5133
<CoreBuildDependsOn>
5234
BuildOnlySettings;
5335
PrepareForBuild;
@@ -59,8 +41,23 @@
5941
IncrementalClean;
6042
PostBuildEvent
6143
</CoreBuildDependsOn>
44+
45+
<!-- Disable symbol generation -->
46+
<DebugType>None</DebugType>
47+
<DebugSymbols>false</DebugSymbols>
48+
49+
<!-- Don't emit a reference assembly -->
50+
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
6251
</PropertyGroup>
6352

53+
<!-- Clear output group items which are read by the IDE and NuGet. -->
54+
<ItemGroup>
55+
<BuiltProjectOutputGroupKeyOutput Remove="@(BuiltProjectOutputGroupKeyOutput)" />
56+
<DebugSymbolsProjectOutputGroupOutput Remove="@(DebugSymbolsProjectOutputGroupOutput)" />
57+
<IntermediateAssembly Remove="@(IntermediateAssembly)" />
58+
<IntermediateRefAssembly Remove="@(IntermediateRefAssembly)" />
59+
</ItemGroup>
60+
6461
<!--
6562
The CopyFilesToOutputDirectory target is hard coded to depend on ComputeIntermediateSatelliteAssemblies. NoTargets projects do no generate resource assemblies
6663
so the target is replaced with a no-op

src/NoTargets/version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"inherit": true,
3-
"version": "3.4"
3+
"version": "3.5"
44
}

0 commit comments

Comments
 (0)