From 15e31d86a96c81fb60e963293babac127374f0b4 Mon Sep 17 00:00:00 2001 From: Marko Lahma Date: Sun, 18 Jun 2023 10:35:24 +0300 Subject: [PATCH] Include all projects in NuGet package --- Directory.Build.props | 23 ++++++++-------- .../NPOI.OpenXmlFormats.Core.csproj | 5 ---- build/Build.cs | 26 ++++++++++++++++--- main/NPOI.Core.csproj | 13 +++++----- ooxml/NPOI.OOXML.Core.csproj | 8 ------ openxml4Net/NPOI.OpenXml4Net.Core.csproj | 5 ---- solution/NPOI.Core.Test.sln | 10 ++++--- solution/NPOI.Pack.csproj | 19 ++++++++++++++ testcases/Directory.Build.props | 9 +++++++ testcases/main/NPOI.TestCases.Core.csproj | 1 - .../ooxml/NPOI.OOXML.TestCases.Core.csproj | 1 - .../NPOI.OOXML4Net.TestCases.Core.csproj | 1 - 12 files changed, 74 insertions(+), 47 deletions(-) create mode 100644 solution/NPOI.Pack.csproj create mode 100644 testcases/Directory.Build.props diff --git a/Directory.Build.props b/Directory.Build.props index b7d7e59cf..0f3e2ddd1 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,22 +1,13 @@ latest + false - - true - - true - - - - - true - snupkg - - $(MSBuildThisFileDirectory)\test.runsettings + portable + $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb 2.6.1 NPOI @@ -34,6 +25,10 @@ xlsx xls Excel Word docx office ole + + true + + @@ -46,6 +41,10 @@ all runtime; build; native; contentfiles; analyzers + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + \ No newline at end of file diff --git a/OpenXmlFormats/NPOI.OpenXmlFormats.Core.csproj b/OpenXmlFormats/NPOI.OpenXmlFormats.Core.csproj index d70bf2c6b..9427acae1 100644 --- a/OpenXmlFormats/NPOI.OpenXmlFormats.Core.csproj +++ b/OpenXmlFormats/NPOI.OpenXmlFormats.Core.csproj @@ -2,7 +2,6 @@ net472;netstandard2.0;netstandard2.1;net6.0 - false NPOI.OpenXmlFormats NPOI.OpenXmlFormats true @@ -10,10 +9,6 @@ ..\solution\$(Configuration)\ - - false - - diff --git a/build/Build.cs b/build/Build.cs index 03760d6a8..29e3b9891 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -45,9 +45,18 @@ protected override void OnBuildInitialized() .Before(Restore) .Executes(() => { - SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(x => x.DeleteDirectory()); + DeleteCompilationArtifacts(); + ArtifactsDirectory.CreateOrCleanDirectory(); }); + static void DeleteCompilationArtifacts() + { + var solutionDirectory = RootDirectory / "solution"; + solutionDirectory.GlobDirectories("**/bin", "**/obj").ForEach(x => x.DeleteDirectory()); + (solutionDirectory / "Debug").DeleteDirectory(); + (solutionDirectory / "Release").DeleteDirectory(); + } + Target Restore => _ => _ .Executes(() => { @@ -68,9 +77,12 @@ protected override void OnBuildInitialized() .SetVerbosity(DotNetVerbosity.Minimal) // obsolete missing XML documentation comment, XML comment on not valid language element, XML comment has badly formed XML, no matching tag in XML comment // need to use escaped separator in order for this to work - .AddProperty("NoWarn", string.Join("%3B", new [] { 618, 1591, 1587, 1570, 1572, 1573 })) + .AddProperty("NoWarn", string.Join("%3B", new [] { 169, 612, 618, 1591, 1587, 1570, 1572, 1573, 1574 })) .SetProjectFile(Solution) ); + + // copy files from projects in order to get them to be part of pack + }); Target Test => _ => _ @@ -92,6 +104,11 @@ protected override void OnBuildInitialized() .Produces(ArtifactsDirectory / "**") .Executes(() => { + // make sure we make fresh build + DeleteCompilationArtifacts(); + + var packTarget = Solution.GetProject("NPOI.Pack"); + DotNetPack(_ =>_ .SetConfiguration(Configuration) .SetOutputDirectory(ArtifactsDirectory) @@ -99,8 +116,9 @@ protected override void OnBuildInitialized() .SetContinuousIntegrationBuild(IsServerBuild) // obsolete missing XML documentation comment, XML comment on not valid language element, XML comment has badly formed XML, no matching tag in XML comment // need to use escaped separator in order for this to work - .AddProperty("NoWarn", string.Join("%3B", new [] { 618, 1591, 1587, 1570, 1572, 1573 })) - .SetProject(Solution.GetProject("NPOI.Core")) + .AddProperty("NoWarn", string.Join("%3B", new [] { 169, 612, 618, 1591, 1587, 1570, 1572, 1573, 1574 })) + .SetProperty("EnablePackageValidation", "false") + .SetProject(packTarget) ); }); } diff --git a/main/NPOI.Core.csproj b/main/NPOI.Core.csproj index 26a0530cf..a7def2ca6 100644 --- a/main/NPOI.Core.csproj +++ b/main/NPOI.Core.csproj @@ -2,18 +2,12 @@ net472;netstandard2.0;netstandard2.1;net6.0 - false - NPOI NPOI true ..\npoi.snk ..\solution\$(Configuration)\ - - true - - @@ -27,7 +21,14 @@ + + + + + + + \ No newline at end of file diff --git a/ooxml/NPOI.OOXML.Core.csproj b/ooxml/NPOI.OOXML.Core.csproj index 21b2e5cdc..11bb7f393 100644 --- a/ooxml/NPOI.OOXML.Core.csproj +++ b/ooxml/NPOI.OOXML.Core.csproj @@ -2,7 +2,6 @@ net472;netstandard2.0;netstandard2.1;net6.0 - false NPOI.OOXML NPOI true @@ -10,13 +9,6 @@ ..\solution\$(Configuration)\ - - - - - true - - diff --git a/openxml4Net/NPOI.OpenXml4Net.Core.csproj b/openxml4Net/NPOI.OpenXml4Net.Core.csproj index 1d9712c47..15fbb7c9c 100644 --- a/openxml4Net/NPOI.OpenXml4Net.Core.csproj +++ b/openxml4Net/NPOI.OpenXml4Net.Core.csproj @@ -2,7 +2,6 @@ net472;netstandard2.0;netstandard2.1;net6.0 - false NPOI.OpenXml4Net NPOI.OpenXml4Net true @@ -10,10 +9,6 @@ ..\solution\$(Configuration)\ - - true - - diff --git a/solution/NPOI.Core.Test.sln b/solution/NPOI.Core.Test.sln index e0072e55c..f7659e966 100644 --- a/solution/NPOI.Core.Test.sln +++ b/solution/NPOI.Core.Test.sln @@ -26,6 +26,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_build", "..\build\_build.c EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NPOI.Benchmarks", "..\benchmarks\NPOI.Benchmarks\NPOI.Benchmarks.csproj", "{3DA1149D-46F8-4181-9976-E002BF2BFB76}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NPOI.Pack", "NPOI.Pack.csproj", "{6D7A6E15-C914-4FCA-B8E4-FF5C7437C2E0}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -60,14 +62,14 @@ Global {DA2CA3BD-1CAC-470C-9FA2-611A5768A76A}.Debug|Any CPU.Build.0 = Debug|Any CPU {DA2CA3BD-1CAC-470C-9FA2-611A5768A76A}.Release|Any CPU.ActiveCfg = Release|Any CPU {DA2CA3BD-1CAC-470C-9FA2-611A5768A76A}.Release|Any CPU.Build.0 = Release|Any CPU - {94B18BCF-84E8-401F-BAAB-0496AA136628}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {94B18BCF-84E8-401F-BAAB-0496AA136628}.Debug|Any CPU.Build.0 = Debug|Any CPU - {94B18BCF-84E8-401F-BAAB-0496AA136628}.Release|Any CPU.ActiveCfg = Release|Any CPU - {94B18BCF-84E8-401F-BAAB-0496AA136628}.Release|Any CPU.Build.0 = Release|Any CPU {3DA1149D-46F8-4181-9976-E002BF2BFB76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3DA1149D-46F8-4181-9976-E002BF2BFB76}.Debug|Any CPU.Build.0 = Debug|Any CPU {3DA1149D-46F8-4181-9976-E002BF2BFB76}.Release|Any CPU.ActiveCfg = Release|Any CPU {3DA1149D-46F8-4181-9976-E002BF2BFB76}.Release|Any CPU.Build.0 = Release|Any CPU + {6D7A6E15-C914-4FCA-B8E4-FF5C7437C2E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6D7A6E15-C914-4FCA-B8E4-FF5C7437C2E0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6D7A6E15-C914-4FCA-B8E4-FF5C7437C2E0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6D7A6E15-C914-4FCA-B8E4-FF5C7437C2E0}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/solution/NPOI.Pack.csproj b/solution/NPOI.Pack.csproj new file mode 100644 index 000000000..a00d1a155 --- /dev/null +++ b/solution/NPOI.Pack.csproj @@ -0,0 +1,19 @@ + + + + + + net472;netstandard2.0;netstandard2.1;net6.0 + false + NPOI + ..\solution\$(Configuration)\ + + + + + + + + + + \ No newline at end of file diff --git a/testcases/Directory.Build.props b/testcases/Directory.Build.props new file mode 100644 index 000000000..51c4db1f2 --- /dev/null +++ b/testcases/Directory.Build.props @@ -0,0 +1,9 @@ + + + + false + false + $(MSBuildProjectDirectory)\..\..\test.runsettings + + + \ No newline at end of file diff --git a/testcases/main/NPOI.TestCases.Core.csproj b/testcases/main/NPOI.TestCases.Core.csproj index c5ceedb3e..135e89749 100644 --- a/testcases/main/NPOI.TestCases.Core.csproj +++ b/testcases/main/NPOI.TestCases.Core.csproj @@ -2,7 +2,6 @@ net472;net6.0 - false NPOI.TestCases TestCases true diff --git a/testcases/ooxml/NPOI.OOXML.TestCases.Core.csproj b/testcases/ooxml/NPOI.OOXML.TestCases.Core.csproj index d96126de6..099b79aa4 100644 --- a/testcases/ooxml/NPOI.OOXML.TestCases.Core.csproj +++ b/testcases/ooxml/NPOI.OOXML.TestCases.Core.csproj @@ -2,7 +2,6 @@ net472;net6.0 - false NPOI.OOXML.TestCases TestCases true diff --git a/testcases/openxml4net/NPOI.OOXML4Net.TestCases.Core.csproj b/testcases/openxml4net/NPOI.OOXML4Net.TestCases.Core.csproj index 39cfca0ea..a3e350d92 100644 --- a/testcases/openxml4net/NPOI.OOXML4Net.TestCases.Core.csproj +++ b/testcases/openxml4net/NPOI.OOXML4Net.TestCases.Core.csproj @@ -2,7 +2,6 @@ net472;net6.0 - false NPOI.OOXML4Net.TestCases TestCases true