Skip to content

Commit 99bfd8c

Browse files
authored
Clean up target files to remove build warnings (#1169)
1 parent a6d83a8 commit 99bfd8c

File tree

6 files changed

+19
-39
lines changed

6 files changed

+19
-39
lines changed

Directory.Build.props

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
88

99
<!-- Because of the size of the project, to facilitate quick development, by default only single
10-
frameworks will be build. This is customizable with the following possible values:
10+
frameworks will be built. This is customizable with the following possible values:
1111
- net35: .NET Framework 3.5
1212
- net40: .NET Framework 4.0
1313
- net46: .NET Framework 4.6
@@ -32,6 +32,11 @@
3232
<Version>$(GitVersion_NuGetVersionV2)</Version>
3333
</PropertyGroup>
3434

35+
<PropertyGroup>
36+
<!-- We need to test on frameworks that may be EOL due to the targets we build -->
37+
<CheckEolTargetFramework>false</CheckEolTargetFramework>
38+
</PropertyGroup>
39+
3540
<Choose>
3641
<When Condition=" '$(ProjectLoadStyle)' == 'net35' ">
3742
<PropertyGroup>
@@ -42,9 +47,6 @@
4247
<BenchmarkTargetFramework>net461</BenchmarkTargetFramework>
4348
<SamplesFrameworks>net46</SamplesFrameworks>
4449
</PropertyGroup>
45-
<ItemGroup>
46-
<Reference Include="WindowsBase" Version="3.0.0.0" />
47-
</ItemGroup>
4850
</When>
4951
<When Condition=" '$(ProjectLoadStyle)' == 'net40' ">
5052
<PropertyGroup>
@@ -55,9 +57,6 @@
5557
<BenchmarkTargetFramework>net461</BenchmarkTargetFramework>
5658
<SamplesFrameworks>net46</SamplesFrameworks>
5759
</PropertyGroup>
58-
<ItemGroup>
59-
<Reference Include="WindowsBase" Version="4.0.0.0" />
60-
</ItemGroup>
6160
</When>
6261
<When Condition=" '$(ProjectLoadStyle)' == 'net46' ">
6362
<PropertyGroup>
@@ -67,9 +66,6 @@
6766
<BenchmarkTargetFramework>net461</BenchmarkTargetFramework>
6867
<SamplesFrameworks>net46</SamplesFrameworks>
6968
</PropertyGroup>
70-
<ItemGroup>
71-
<Reference Include="WindowsBase" />
72-
</ItemGroup>
7369
</When>
7470
<When Condition=" '$(ProjectLoadStyle)' == 'netstandard1_3' ">
7571
<PropertyGroup>
@@ -122,10 +118,6 @@
122118
<BenchmarkTargetFramework>net5.0</BenchmarkTargetFramework>
123119
<SamplesFrameworks>net46;netcoreapp2.1;netcoreapp3.1;net5.0</SamplesFrameworks>
124120
</PropertyGroup>
125-
126-
<ItemGroup Condition=" '$(TargetFramework)' == 'net35' OR '$(TargetFramework)' == 'net40' OR '$(TargetFramework)'=='net452' OR '$(TargetFramework)' == 'net46' ">
127-
<Reference Include="WindowsBase" />
128-
</ItemGroup>
129121
</When>
130122
<Otherwise>
131123
<PropertyGroup>

Directory.Build.targets

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@
6464
</PackageReference>
6565
</ItemGroup>
6666

67-
<Import Project="$(MSBuildThisFileDirectory)\Tests.targets" />
68-
6967
<!-- The tool is used by default, but we don't want it to. It must be set in a target to ensure it is not overridden -->
7068
<Target Name="BeforeResGen" Condition=" '$(TargetFramework)' == 'net35' ">
7169
<PropertyGroup>
@@ -84,4 +82,8 @@
8482
<PackageOutputPath>$(MSBuildThisFileDirectory)bin\$(Configuration)\packages\</PackageOutputPath>
8583
<PackageOutputPath Condition="$(IsShipped)">$(PackageOutputPath)shipping\</PackageOutputPath>
8684
</PropertyGroup>
85+
86+
<ItemGroup Condition=" '$(TargetFramework)' == 'net35' OR $(TargetFramework.StartsWith('net4'))">
87+
<Reference Include="WindowsBase" />
88+
</ItemGroup>
8789
</Project>

build/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
ProjectLoadStyle: ${{ buildTarget.name }}
2020
steps:
2121
- task: UseDotNet@2
22-
displayName: 'Install .NET Core SDK for building'
22+
displayName: 'Install global.json .NET Core SDK'
2323
inputs:
2424
packageType: 'sdk'
2525
useGlobalJson: true

test/Directory.Build.props

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project>
3+
<Import Project="..\Directory.Build.props" />
4+
</Project>

Tests.targets renamed to test/Directory.Build.targets

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,17 @@
1010
framework library doesn't require System.Net.Http. This is brought in by the .NET Core app framework -->
1111
<PackageReference Include="System.Net.Http" Version="4.3.4" Condition="!$(IsShipped)" />
1212

13+
<!-- Need to bring this in manually as the test framework itself tries to bring in 9.0.0 -->
14+
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
1315
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
14-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
15-
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
16+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
1617
<PackageReference Include="NSubstitute" Version="4.3.0" />
1718
<PackageReference Include="xunit" Version="2.4.1" />
1819
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
1920
<PrivateAssets>all</PrivateAssets>
2021
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
2122
</PackageReference>
2223
</ItemGroup>
23-
24-
<ItemGroup Condition="$(TargetFramework.StartsWith('netcoreapp1.'))">
25-
<PackageReference Include="System.Xml.ReaderWriter" Version="4.3.1" />
26-
<PackageReference Include="System.Xml.XmlDocument" Version="4.3.0" />
27-
<PackageReference Include="System.Reflection.Extensions" Version="4.3.0" />
28-
<PackageReference Include="System.Runtime.Extensions" Version="4.3.0" />
29-
</ItemGroup>
30-
31-
<ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
32-
<Reference Include="System" />
33-
<Reference Include="Microsoft.CSharp" />
34-
</ItemGroup>
35-
36-
<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
37-
<Reference Include="System" />
38-
<Reference Include="Microsoft.CSharp" />
39-
<Reference Include="WindowsBase" />
40-
</ItemGroup>
4124
</When>
4225
</Choose>
4326

@@ -54,4 +37,5 @@
5437

5538
<Target Name="PublishAll" Condition="$(IsTestProject) OR $(IsBenchmarkProject)" DependsOnTargets="PublishProjectIfFrameworkSet;PublishProjectForAllFrameworksIfFrameworkUnset" />
5639

40+
<Import Project="..\Directory.Build.targets" />
5741
</Project>

test/DocumentFormat.OpenXml.Generator.Tests/DocumentFormat.OpenXml.Generator.Tests.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
<PropertyGroup>
44
<TargetFrameworks>net6.0</TargetFrameworks>
5-
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
6-
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
75
<IsTestProject>true</IsTestProject>
86
</PropertyGroup>
97

0 commit comments

Comments
 (0)