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

Commit c91825c

Browse files
committed
[MSBuild] Allow types to be excluded when generating intersection
<PropertyGroup> <IntersectionExcludeType>Type1;Type2</IntersectionExcludeType> </PropertyGroup> The type names are passed to ApiIntersect using the -b parameter.
1 parent da998fc commit c91825c

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

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

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

1818
public ITaskItem[] ReferencePath { get; set; }
1919

20+
public ITaskItem[] ExcludeType { get; set; }
21+
2022
[Required]
2123
public ITaskItem RootOutputDirectory { get; set; }
2224

@@ -64,6 +66,14 @@ protected override string GenerateCommandLineCommands()
6466
builder.AppendFileNameIfNotNull(referencePath.ItemSpec);
6567
}
6668

69+
foreach (var excludeType in ExcludeType.NullAsEmpty())
70+
{
71+
builder.AppendSwitch("-b");
72+
builder.AppendTextUnquoted(" \"");
73+
builder.AppendTextUnquoted(excludeType.ItemSpec);
74+
builder.AppendTextUnquoted("\"");
75+
}
76+
6777
return builder.ToString();
6878
}
6979

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,7 @@ Copyright (c) .NET Foundation. All rights reserved.
522522
RootOutputDirectory="$(IntermediateOutputPath)"
523523
IntersectionAssembly="@(IntersectionAssembly)"
524524
ReferencePath="$(IntersectionAssemblyReferencePath)"
525+
ExcludeType="$(IntersectionExcludeType)"
525526
ToolPath="$(ApiIntersectToolPath)"
526527
ToolExe="$(ApiIntersectToolExe)">
527528
<Output TaskParameter="OutputDirectory" ItemName="_ReferenceAssemblyBuildInfo" />

0 commit comments

Comments
 (0)