From 1e213a00cedc54a7dea2c42bb42a292405ffeaeb Mon Sep 17 00:00:00 2001 From: Daniel Cazzulino Date: Thu, 16 Oct 2025 19:21:07 -0300 Subject: [PATCH] Repack tasks extensions to avoid collisions with other analyzers This is something we got for free from the SponsorLink v2 targets and we missed in the migration to OSMF. --- src/Directory.props | 2 + src/Directory.targets | 9 +- src/ILRepack.targets | 89 +++++++++++++++++++ .../ThisAssembly.Tests.csproj | 1 + 4 files changed, 94 insertions(+), 7 deletions(-) create mode 100644 src/ILRepack.targets diff --git a/src/Directory.props b/src/Directory.props index 07073978..732cac5f 100644 --- a/src/Directory.props +++ b/src/Directory.props @@ -34,6 +34,8 @@ + + diff --git a/src/Directory.targets b/src/Directory.targets index e333db1f..20f2ecff 100644 --- a/src/Directory.targets +++ b/src/Directory.targets @@ -26,16 +26,10 @@ !$([MSBuild]::ValueOrDefault('%(FileName)', '').StartsWith('Microsoft.CSharp', StringComparison.OrdinalIgnoreCase)) And !$([MSBuild]::ValueOrDefault('%(FileName)', '').StartsWith('System.', StringComparison.OrdinalIgnoreCase))" /> - - - + @@ -66,4 +60,5 @@ + diff --git a/src/ILRepack.targets b/src/ILRepack.targets new file mode 100644 index 00000000..410b604b --- /dev/null +++ b/src/ILRepack.targets @@ -0,0 +1,89 @@ + + + + + true + false + + true + + + + + + + + + + + + + + + + + + ;@(ILRepackInclude, ';'); + ;@(ILRepackExclude, ';'); + + + + + + + + + + + + + + + + $([System.IO.Path]::GetFullPath($([System.IO.Path]::Combine('$(MSBuildProjectDirectory)','$(AssemblyOriginatorKeyFile)')))) + /keyfile:"$(AbsoluteAssemblyOriginatorKeyFile)" /delaysign + $(ILRepackArgs) /internalize + $(ILRepackArgs) /union + + $(ILRepackArgs) @(LibDir -> '/lib:"%(Identity)."', ' ') + $(ILRepackArgs) /out:"@(IntermediateAssembly -> '%(FullPath)')" + $(ILRepackArgs) "@(IntermediateAssembly -> '%(FullPath)')" + $(ILRepackArgs) @(MergedAssemblies -> '"%(FullPath)"', ' ') + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ThisAssembly.Tests/ThisAssembly.Tests.csproj b/src/ThisAssembly.Tests/ThisAssembly.Tests.csproj index e78c6db7..b6d68102 100644 --- a/src/ThisAssembly.Tests/ThisAssembly.Tests.csproj +++ b/src/ThisAssembly.Tests/ThisAssembly.Tests.csproj @@ -27,6 +27,7 @@ true true win-x64;linux-x86 + false