Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Commit dc1f17d

Browse files
committed
[MSBuild] Allow excluding types from an assembly when generating intersection
<ItemGroup> <IntersectionExcludeAssembly Include="path/to/assembly.dll" /> </ItemGroup> Maps to the -e parameter used by ApiIntersect.
1 parent 9c1b05f commit dc1f17d

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

src/Build/NuGet.Build.Packaging.Tasks/ApiIntersect.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ public class ApiIntersect : ToolTask
2121

2222
public ITaskItem[] RemoveAbstractTypeMembers { get; set; }
2323

24+
public ITaskItem[] ExcludeAssembly { get; set; }
25+
2426
public string KeepInternalConstructors { get; set; }
2527

2628
public string KeepMarshalling { get; set; }
@@ -88,6 +90,12 @@ protected override string GenerateCommandLineCommands()
8890
builder.AppendTextUnquoted("\"");
8991
}
9092

93+
foreach (var assembly in ExcludeAssembly.NullAsEmpty())
94+
{
95+
builder.AppendSwitch("-e");
96+
builder.AppendFileNameIfNotNull(assembly.ItemSpec);
97+
}
98+
9199
AppendSwitchIfTrue(builder, "-k", KeepInternalConstructors);
92100

93101
AppendSwitchIfTrue(builder, "-m", KeepMarshalling);

src/Build/NuGet.Build.Packaging.Tasks/NuGet.Build.Packaging.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@ Copyright (c) .NET Foundation. All rights reserved.
524524
ReferencePath="$(IntersectionAssemblyReferencePath)"
525525
ExcludeType="$(IntersectionExcludeType)"
526526
RemoveAbstractTypeMembers="$(IntersectionRemoveAbstractTypeMembers)"
527+
ExcludeAssembly="@(IntersectionExcludeAssembly)"
527528
KeepInternalConstructors="$(IntersectionKeepInternalConstructors)"
528529
KeepMarshalling="$(IntersectionKeepMarshalling)"
529530
ToolPath="$(ApiIntersectToolPath)"

0 commit comments

Comments
 (0)