Skip to content

Commit c027cdb

Browse files
authored
Remove unnecessary explicit System.IO.Packaging for SDK (#1471)
1 parent e2b8a44 commit c027cdb

File tree

11 files changed

+22
-120
lines changed

11 files changed

+22
-120
lines changed

.github/workflows/benchmarks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
run: cd test/DocumentFormat.OpenXml.Benchmarks; dotnet build -c RELEASE
2323
shell: pwsh
2424
- name: Run benchmarks
25-
run: cd test/DocumentFormat.OpenXml.Benchmarks; dotnet run -c RELEASE -- results --exporters json --filter '*'
25+
run: cd test/DocumentFormat.OpenXml.Benchmarks; dotnet run -c RELEASE -f net7.0 -- results --exporters json --filter '*'
2626
shell: pwsh
2727
- name: Write summary
2828
shell: pwsh

Directory.Build.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@
111111
<PropertyGroup>
112112
<SupportsNetStandard>true</SupportsNetStandard>
113113
<SupportsNetStandard Condition=" '$(TargetFramework)' == 'net35' OR '$(TargetFramework)' == 'net40' OR '$(TargetFramework)' == 'net452' OR '$(TargetFramework)' == 'net46' ">false</SupportsNetStandard>
114+
<IsFramework>false</IsFramework>
115+
<IsFramework Condition=" '$(TargetFramework)' == 'net35' OR $(TargetFramework.StartsWith('net4')) ">true</IsFramework>
114116
</PropertyGroup>
115117

116118
<Target Name="UnknownProjectLoadStyle" BeforeTargets="Build" Condition="$(__InvalidProjectLoadStyle)">

Directory.Build.targets

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<PrivateAssets>all</PrivateAssets>
1212
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
1313
</PackageReference>
14+
<Reference Condition="$(IsFramework)" Include="WindowsBase" />
1415
</ItemGroup>
1516
<!-- 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 -->
1617
<Target Name="BeforeResGen" Condition=" '$(TargetFramework)' == 'net35' ">
@@ -27,7 +28,4 @@
2728
<PackageOutputPath>$(MSBuildThisFileDirectory)bin\$(Configuration)\packages\</PackageOutputPath>
2829
<PackageOutputPath Condition="$(IsShipped)">$(PackageOutputPath)shipping\</PackageOutputPath>
2930
</PropertyGroup>
30-
<ItemGroup Condition=" '$(TargetFramework)' == 'net35' OR $(TargetFramework.StartsWith('net4'))">
31-
<Reference Include="WindowsBase" />
32-
</ItemGroup>
3331
</Project>

src/Directory.Build.targets

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
<!--<PackageValidationBaselineVersion>2.18.0</PackageValidationBaselineVersion>-->
77
</PropertyGroup>
88

9+
<ItemGroup Condition="$(IsFramework)">
10+
<Reference Include="System" />
11+
<Reference Include="System.Xml" />
12+
</ItemGroup>
13+
914
<Import Project="$(MSBuildThisFileDirectory)\PEVerify.targets" />
1015

1116
<Import Project="..\Directory.Build.targets" />

src/DocumentFormat.OpenXml.Features/ParagraphId/ParagraphIdOptions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ namespace DocumentFormat.OpenXml.Features
99
public class ParagraphIdOptions
1010
{
1111
/// <summary>
12-
/// Gets a value indicating whether or not paragraph ids should be auto-generated on elements.
12+
/// Gets or sets a value indicating whether or not paragraph ids should be auto-generated on elements.
1313
/// </summary>
14-
public bool AutoGenerateIds { get; init; } = true;
14+
public bool AutoGenerateIds { get; set; } = true;
1515

1616
/// <summary>
17-
/// Gets a value indicating whether or not uniqueness should be guaranteed on elements added to the document. This will change a node's para id if it has already been registered.
17+
/// Gets or sets a value indicating whether or not uniqueness should be guaranteed on elements added to the document. This will change a node's para id if it has already been registered.
1818
/// </summary>
19-
public bool EnsureUniquenessOnExistingNodes { get; init; } = true;
19+
public bool EnsureUniquenessOnExistingNodes { get; set; } = true;
2020
}
2121
}

src/DocumentFormat.OpenXml.Framework/DocumentFormat.OpenXml.Framework.csproj

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -29,46 +29,9 @@
2929
<RootNamespace>DocumentFormat.OpenXml</RootNamespace>
3030
</PropertyGroup>
3131

32-
<Choose>
33-
<When Condition=" '$(TargetFramework)' == 'net35'">
34-
<PropertyGroup>
35-
<CompileWithPeVerify>true</CompileWithPeVerify>
36-
</PropertyGroup>
37-
38-
<ItemGroup>
39-
<Reference Include="System" />
40-
<Reference Include="System.Xml" />
41-
</ItemGroup>
42-
</When>
43-
44-
<When Condition=" '$(TargetFramework)' == 'net40' ">
45-
<PropertyGroup>
46-
<CompileWithPeVerify>true</CompileWithPeVerify>
47-
</PropertyGroup>
48-
49-
<ItemGroup>
50-
<Reference Include="System" />
51-
<Reference Include="System.Xml" />
52-
</ItemGroup>
53-
</When>
54-
55-
<When Condition=" '$(TargetFramework)' == 'net46' ">
56-
<PropertyGroup>
57-
<CompileWithPeVerify>true</CompileWithPeVerify>
58-
</PropertyGroup>
59-
60-
<ItemGroup>
61-
<Reference Include="System" />
62-
<Reference Include="System.Xml" />
63-
</ItemGroup>
64-
</When>
65-
66-
<When Condition="'$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == 'net6.0' OR '$(TargetFramework)' == 'net7.0' ">
67-
<ItemGroup>
68-
<PackageReference Include="System.IO.Packaging" />
69-
</ItemGroup>
70-
</When>
71-
</Choose>
32+
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == 'net6.0' OR '$(TargetFramework)' == 'net7.0' ">
33+
<PackageReference Include="System.IO.Packaging" />
34+
</ItemGroup>
7235

7336
<ItemGroup>
7437
<Compile Update="Resources\ExceptionMessages.Designer.cs">

src/DocumentFormat.OpenXml.Linq/DocumentFormat.OpenXml.Linq.csproj

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,8 @@
1818
<ProjectReference Include="..\DocumentFormat.OpenXml.Framework\DocumentFormat.OpenXml.Framework.csproj" />
1919
</ItemGroup>
2020

21-
<Choose>
22-
<When Condition=" '$(TargetFramework)' == 'net35'">
23-
<ItemGroup>
24-
<Reference Include="System" />
25-
<Reference Include="System.Xml" />
26-
<Reference Include="System.Xml.Linq" />
27-
</ItemGroup>
28-
</When>
29-
30-
<When Condition=" '$(TargetFramework)' == 'net40'">
31-
<ItemGroup>
32-
<Reference Include="System" />
33-
<Reference Include="System.Xml" />
34-
<Reference Include="System.Xml.Linq" />
35-
</ItemGroup>
36-
</When>
37-
38-
<When Condition=" '$(TargetFramework)' == 'net46'">
39-
<ItemGroup>
40-
<Reference Include="System" />
41-
<Reference Include="System.Xml" />
42-
<Reference Include="System.Xml.Linq" />
43-
</ItemGroup>
44-
</When>
45-
46-
</Choose>
21+
<ItemGroup Condition="$(IsFramework)">
22+
<Reference Include="System.Xml.Linq" />
23+
</ItemGroup>
4724

4825
</Project>

src/DocumentFormat.OpenXml/DocumentFormat.OpenXml.csproj

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -35,45 +35,4 @@
3535
<ProjectReference Include="../DocumentFormat.OpenXml.Framework/DocumentFormat.OpenXml.Framework.csproj" />
3636
</ItemGroup>
3737

38-
<Choose>
39-
<When Condition=" '$(TargetFramework)' == 'net35'">
40-
<PropertyGroup>
41-
<CompileWithPeVerify>true</CompileWithPeVerify>
42-
</PropertyGroup>
43-
44-
<ItemGroup>
45-
<Reference Include="System" />
46-
<Reference Include="System.Xml" />
47-
</ItemGroup>
48-
</When>
49-
50-
<When Condition=" '$(TargetFramework)' == 'net40' ">
51-
<PropertyGroup>
52-
<CompileWithPeVerify>true</CompileWithPeVerify>
53-
</PropertyGroup>
54-
55-
<ItemGroup>
56-
<Reference Include="System" />
57-
<Reference Include="System.Xml" />
58-
</ItemGroup>
59-
</When>
60-
61-
<When Condition=" '$(TargetFramework)' == 'net46' ">
62-
<PropertyGroup>
63-
<CompileWithPeVerify>true</CompileWithPeVerify>
64-
</PropertyGroup>
65-
66-
<ItemGroup>
67-
<Reference Include="System" />
68-
<Reference Include="System.Xml" />
69-
</ItemGroup>
70-
</When>
71-
72-
<When Condition="'$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == 'net6.0' OR '$(TargetFramework)' == 'net7.0' ">
73-
<ItemGroup>
74-
<PackageReference Include="System.IO.Packaging" />
75-
</ItemGroup>
76-
</When>
77-
</Choose>
78-
7938
</Project>

src/PEVerify.targets

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
<PropertyGroup>
44
<!-- .NET Framework builds should pass PEVerify -->
55
<RunPeVerify Condition=" '$(RunPeVerify)' == '' ">false</RunPeVerify>
6-
<CompileWithPeVerify Condition=" '$(CompileWithPeVerify)' == '' ">false</CompileWithPeVerify>
76
<PeVerifyPath Condition=" '$(PeVerifyPath)' == '' ">C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\PEVerify.exe</PeVerifyPath>
87
</PropertyGroup>
98

10-
<PropertyGroup Condition="$(CompileWithPeVerify)">
9+
<PropertyGroup Condition="$(IsFramework)">
1110
<Features>$(Features);peverify-compat</Features>
1211
</PropertyGroup>
1312

14-
<Target Name="Run PEVerify" AfterTargets="Build" Condition="$(CompileWithPeVerify) AND $(RunPeVerify)">
13+
<Target Name="Run PEVerify" AfterTargets="Build" Condition="$(IsFramework) AND $(RunPeVerify)">
1514
<ItemGroup>
1615
<_OutputFileToVerify Include="@(FileWrites)" Condition="'%(Extension)' == '.dll' AND $([System.Text.RegularExpressions.Regex]::IsMatch('%(FullPath)', '.+\\bin\\.+'))" />
1716
</ItemGroup>

test/Directory.Build.targets

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
</Compile>
1313
</ItemGroup>
1414
<ItemGroup>
15-
<!-- Need to bring this in manually as the test framework itself tries to bring in 9.0.0 -->
1615
<PackageReference Include="Newtonsoft.Json" />
1716
<PackageReference Include="System.ValueTuple" />
1817
<PackageReference Include="Microsoft.NET.Test.Sdk" />

0 commit comments

Comments
 (0)