Skip to content

Commit ca7e4b8

Browse files
authored
Bring back extension methods, fix formatting of xml doc comments (#144)
1 parent 6acd112 commit ca7e4b8

36 files changed

+306
-285
lines changed

src/Microsoft.Build.Utilities.ProjectCreation.UnitTests/ExtensibilityTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace Microsoft.Build.Utilities.ProjectCreation.UnitTests
1111
public class ExtensibilityTests : MSBuildTestBase
1212
{
1313
/// <summary>
14-
/// Proves that <see cref="ProjectCreator"/> can be extended by and end user through extension methods.
14+
/// Proves that <see cref="ProjectCreator" /> can be extended by and end user through extension methods.
1515
/// </summary>
1616
[Fact]
1717
public void CustomExtensionMethod()

src/Microsoft.Build.Utilities.ProjectCreation/BuildEngine.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,51 +9,51 @@
99
namespace Microsoft.Build.Utilities.ProjectCreation
1010
{
1111
/// <summary>
12-
/// Represents an implementation of <see cref="IBuildEngine"/> that allows for capturing logged events in tasks.
12+
/// Represents an implementation of <see cref="IBuildEngine" /> that allows for capturing logged events in tasks.
1313
/// </summary>
1414
public sealed class BuildEngine : BuildEventArgsCollection, IBuildEngine
1515
{
1616
private BuildEngine()
1717
{
1818
}
1919

20-
/// <inheritdoc cref="IBuildEngine.ColumnNumberOfTaskNode"/>
20+
/// <inheritdoc cref="IBuildEngine.ColumnNumberOfTaskNode" />
2121
public int ColumnNumberOfTaskNode => 0;
2222

23-
/// <inheritdoc cref="IBuildEngine.ContinueOnError"/>
23+
/// <inheritdoc cref="IBuildEngine.ContinueOnError" />
2424
public bool ContinueOnError => false;
2525

26-
/// <inheritdoc cref="IBuildEngine.LineNumberOfTaskNode"/>
26+
/// <inheritdoc cref="IBuildEngine.LineNumberOfTaskNode" />
2727
public int LineNumberOfTaskNode => 0;
2828

29-
/// <inheritdoc cref="IBuildEngine.ProjectFileOfTaskNode"/>
29+
/// <inheritdoc cref="IBuildEngine.ProjectFileOfTaskNode" />
3030
public string? ProjectFileOfTaskNode => null;
3131

3232
/// <summary>
33-
/// Creates an instance of the <see cref="BuildEngine"/> class.
33+
/// Creates an instance of the <see cref="BuildEngine" /> class.
3434
/// </summary>
35-
/// <returns>A <see cref="BuildEngine"/> instance.</returns>
35+
/// <returns>A <see cref="BuildEngine" /> instance.</returns>
3636
public static BuildEngine Create()
3737
{
3838
return new BuildEngine();
3939
}
4040

41-
/// <inheritdoc cref="IBuildEngine.BuildProjectFile"/>
41+
/// <inheritdoc cref="IBuildEngine.BuildProjectFile" />
4242
public bool BuildProjectFile(string projectFileName, string[] targetNames, IDictionary globalProperties, IDictionary targetOutputs)
4343
{
4444
throw new NotSupportedException();
4545
}
4646

47-
/// <inheritdoc cref="IBuildEngine.LogCustomEvent"/>
47+
/// <inheritdoc cref="IBuildEngine.LogCustomEvent" />
4848
public void LogCustomEvent(CustomBuildEventArgs e) => Add(e);
4949

50-
/// <inheritdoc cref="IBuildEngine.LogErrorEvent"/>
50+
/// <inheritdoc cref="IBuildEngine.LogErrorEvent" />
5151
public void LogErrorEvent(BuildErrorEventArgs e) => Add(e);
5252

53-
/// <inheritdoc cref="IBuildEngine.LogMessageEvent"/>
53+
/// <inheritdoc cref="IBuildEngine.LogMessageEvent" />
5454
public void LogMessageEvent(BuildMessageEventArgs e) => Add(e);
5555

56-
/// <inheritdoc cref="IBuildEngine.LogWarningEvent"/>
56+
/// <inheritdoc cref="IBuildEngine.LogWarningEvent" />
5757
public void LogWarningEvent(BuildWarningEventArgs e) => Add(e);
5858
}
5959
}

src/Microsoft.Build.Utilities.ProjectCreation/BuildEventArgsCollection.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
namespace Microsoft.Build.Utilities.ProjectCreation
1414
{
1515
/// <summary>
16-
/// Represents a collection of <see cref="BuildEventArgs"/> objects.
16+
/// Represents a collection of <see cref="BuildEventArgs" /> objects.
1717
/// </summary>
1818
public abstract class BuildEventArgsCollection : IDisposable
1919
{
@@ -38,7 +38,7 @@ public abstract class BuildEventArgsCollection : IDisposable
3838
private readonly ConcurrentQueue<BuildEventArgs> _allEvents = new ConcurrentQueue<BuildEventArgs>();
3939

4040
/// <summary>
41-
/// Initializes a new instance of the <see cref="BuildEventArgsCollection"/> class.
41+
/// Initializes a new instance of the <see cref="BuildEventArgsCollection" /> class.
4242
/// </summary>
4343
protected BuildEventArgsCollection()
4444
{
@@ -67,7 +67,7 @@ protected BuildEventArgsCollection()
6767
public BuildMessageEventArgsCollection MessageEvents { get; }
6868

6969
/// <summary>
70-
/// Gets a <see cref="BuildMessageCollection"/> object that gets the messages from the build.
70+
/// Gets a <see cref="BuildMessageCollection" /> object that gets the messages from the build.
7171
/// </summary>
7272
public BuildMessageCollection Messages { get; }
7373

@@ -81,7 +81,7 @@ protected BuildEventArgsCollection()
8181
/// </summary>
8282
public IReadOnlyCollection<string> Warnings => _warningEvents.Select(i => i.Message).ToList();
8383

84-
/// <inheritdoc cref="IDisposable.Dispose"/>
84+
/// <inheritdoc cref="IDisposable.Dispose" />
8585
public virtual void Dispose()
8686
{
8787
_errorEvents.Clear();
@@ -160,7 +160,7 @@ public string GetConsoleLog(LoggerVerbosity verbosity = LoggerVerbosity.Normal)
160160
/// <summary>
161161
/// Adds a build event.
162162
/// </summary>
163-
/// <param name="buildEventArgs">A <see cref="BuildEventArgs"/> object to add.</param>
163+
/// <param name="buildEventArgs">A <see cref="BuildEventArgs" /> object to add.</param>
164164
protected void Add(BuildEventArgs buildEventArgs)
165165
{
166166
_allEvents.Enqueue(buildEventArgs);

src/Microsoft.Build.Utilities.ProjectCreation/BuildMessageCollection.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,39 +18,39 @@ public sealed class BuildMessageCollection : IReadOnlyCollection<string>
1818
private readonly BuildEventArgsCollection _buildOutput;
1919

2020
/// <summary>
21-
/// Initializes a new instance of the <see cref="BuildMessageCollection"/> class.
21+
/// Initializes a new instance of the <see cref="BuildMessageCollection" /> class.
2222
/// </summary>
23-
/// <param name="buildOutput">The <see cref="BuildEventArgsCollection"/> object that has message events.</param>
23+
/// <param name="buildOutput">The <see cref="BuildEventArgsCollection" /> object that has message events.</param>
2424
internal BuildMessageCollection(BuildEventArgsCollection buildOutput)
2525
{
2626
_buildOutput = buildOutput ?? throw new ArgumentNullException(nameof(buildOutput));
2727
}
2828

29-
/// <inheritdoc cref="IReadOnlyCollection{T}.Count"/>
29+
/// <inheritdoc cref="IReadOnlyCollection{T}.Count" />
3030
public int Count => _buildOutput.MessageEvents.Count;
3131

3232
/// <summary>
33-
/// Gets the messages that were logged with <see cref="MessageImportance.High"/>.
33+
/// Gets the messages that were logged with <see cref="MessageImportance.High" />.
3434
/// </summary>
3535
public IReadOnlyCollection<string> High => _buildOutput.MessageEvents.High.Select(i => i.Message).ToList();
3636

3737
/// <summary>
38-
/// Gets the messages that were logged with <see cref="MessageImportance.Low"/>.
38+
/// Gets the messages that were logged with <see cref="MessageImportance.Low" />.
3939
/// </summary>
4040
public IReadOnlyCollection<string> Low => _buildOutput.MessageEvents.Low.Select(i => i.Message).ToList();
4141

4242
/// <summary>
43-
/// Gets the messages that were logged with <see cref="MessageImportance.Normal"/>.
43+
/// Gets the messages that were logged with <see cref="MessageImportance.Normal" />.
4444
/// </summary>
4545
public IReadOnlyCollection<string> Normal => _buildOutput.MessageEvents.Normal.Select(i => i.Message).ToList();
4646

47-
/// <inheritdoc cref="IEnumerable{T}.GetEnumerator"/>
47+
/// <inheritdoc cref="IEnumerable{T}.GetEnumerator" />
4848
public IEnumerator<string> GetEnumerator()
4949
{
5050
return _buildOutput.MessageEvents.Select(i => i.Message).ToList().GetEnumerator();
5151
}
5252

53-
/// <inheritdoc cref="IEnumerable.GetEnumerator"/>
53+
/// <inheritdoc cref="IEnumerable.GetEnumerator" />
5454
IEnumerator IEnumerable.GetEnumerator()
5555
{
5656
return GetEnumerator();

src/Microsoft.Build.Utilities.ProjectCreation/BuildMessageEventArgsCollection.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,46 +11,46 @@
1111
namespace Microsoft.Build.Utilities.ProjectCreation
1212
{
1313
/// <summary>
14-
/// Represents the <see cref="BuildMessageEventArgs"/> that were logged.
14+
/// Represents the <see cref="BuildMessageEventArgs" /> that were logged.
1515
/// </summary>
1616
public sealed class BuildMessageEventArgsCollection : IReadOnlyCollection<BuildMessageEventArgs>
1717
{
1818
private readonly IReadOnlyCollection<BuildMessageEventArgs> _messageEvents;
1919

2020
/// <summary>
21-
/// Initializes a new instance of the <see cref="BuildMessageEventArgsCollection"/> class.
21+
/// Initializes a new instance of the <see cref="BuildMessageEventArgsCollection" /> class.
2222
/// </summary>
23-
/// <param name="messageEvents">A <see cref="IReadOnlyCollection{BuildMessageEventArgs}"/> containing the logged message events.</param>
23+
/// <param name="messageEvents">A <see cref="IReadOnlyCollection{BuildMessageEventArgs}" /> containing the logged message events.</param>
2424
internal BuildMessageEventArgsCollection(IReadOnlyCollection<BuildMessageEventArgs> messageEvents)
2525
{
2626
_messageEvents = messageEvents ?? throw new ArgumentNullException(nameof(messageEvents));
2727
}
2828

29-
/// <inheritdoc cref="IReadOnlyCollection{T}.Count"/>
29+
/// <inheritdoc cref="IReadOnlyCollection{T}.Count" />
3030
public int Count => _messageEvents.Count;
3131

3232
/// <summary>
33-
/// Gets the <see cref="BuildMessageEventArgs"/> that were logged with <see cref="MessageImportance.High"/>.
33+
/// Gets the <see cref="BuildMessageEventArgs" /> that were logged with <see cref="MessageImportance.High" />.
3434
/// </summary>
3535
public IReadOnlyCollection<BuildMessageEventArgs> High => _messageEvents.Where(i => i.Importance == MessageImportance.High).ToList();
3636

3737
/// <summary>
38-
/// Gets the <see cref="BuildMessageEventArgs"/> that were logged with <see cref="MessageImportance.Low"/>.
38+
/// Gets the <see cref="BuildMessageEventArgs" /> that were logged with <see cref="MessageImportance.Low" />.
3939
/// </summary>
4040
public IReadOnlyCollection<BuildMessageEventArgs> Low => _messageEvents.Where(i => i.Importance == MessageImportance.Low).ToList();
4141

4242
/// <summary>
43-
/// Gets the <see cref="BuildMessageEventArgs"/> that were logged with <see cref="MessageImportance.Normal"/>.
43+
/// Gets the <see cref="BuildMessageEventArgs" /> that were logged with <see cref="MessageImportance.Normal" />.
4444
/// </summary>
4545
public IReadOnlyCollection<BuildMessageEventArgs> Normal => _messageEvents.Where(i => i.Importance == MessageImportance.Normal).ToList();
4646

47-
/// <inheritdoc cref="IEnumerable{T}.GetEnumerator"/>
47+
/// <inheritdoc cref="IEnumerable{T}.GetEnumerator" />
4848
public IEnumerator<BuildMessageEventArgs> GetEnumerator()
4949
{
5050
return _messageEvents.GetEnumerator();
5151
}
5252

53-
/// <inheritdoc cref="IEnumerable.GetEnumerator"/>
53+
/// <inheritdoc cref="IEnumerable.GetEnumerator" />
5454
IEnumerator IEnumerable.GetEnumerator()
5555
{
5656
return GetEnumerator();

src/Microsoft.Build.Utilities.ProjectCreation/BuildOutput.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public sealed class BuildOutput : BuildEventArgsCollection, ILogger
2020
private readonly ConcurrentDictionary<string, bool> _resultsByProject = new ConcurrentDictionary<string, bool>(StringComparer.OrdinalIgnoreCase);
2121

2222
/// <summary>
23-
/// Stores the <see cref="BuildFinishedEventArgs"/> that were logged when the build finished.
23+
/// Stores the <see cref="BuildFinishedEventArgs" /> that were logged when the build finished.
2424
/// </summary>
2525
private BuildFinishedEventArgs? _buildFinished;
2626

@@ -29,7 +29,7 @@ private BuildOutput()
2929
Parameters = string.Empty;
3030
}
3131

32-
/// <inheritdoc cref="ILogger.Parameters"/>
32+
/// <inheritdoc cref="ILogger.Parameters" />
3333
public string Parameters { get; set; }
3434

3535
/// <summary>
@@ -42,35 +42,35 @@ private BuildOutput()
4242
/// </summary>
4343
public bool? Succeeded => _buildFinished?.Succeeded;
4444

45-
/// <inheritdoc cref="ILogger.Verbosity"/>
45+
/// <inheritdoc cref="ILogger.Verbosity" />
4646
public LoggerVerbosity Verbosity { get; set; }
4747

4848
/// <summary>
49-
/// Creates an instance of the <see cref="BuildOutput"/> class.
49+
/// Creates an instance of the <see cref="BuildOutput" /> class.
5050
/// </summary>
51-
/// <returns>A <see cref="BuildOutput"/> instance.</returns>
51+
/// <returns>A <see cref="BuildOutput" /> instance.</returns>
5252
public static BuildOutput Create()
5353
{
5454
return new BuildOutput();
5555
}
5656

57-
/// <inheritdoc cref="IDisposable.Dispose"/>
57+
/// <inheritdoc cref="IDisposable.Dispose" />
5858
public override void Dispose()
5959
{
6060
_buildFinished = null;
6161

6262
base.Dispose();
6363
}
6464

65-
/// <inheritdoc cref="ILogger.Initialize"/>
65+
/// <inheritdoc cref="ILogger.Initialize" />
6666
public void Initialize(IEventSource eventSource)
6767
{
6868
eventSource.BuildFinished += OnBuildFinished;
6969
eventSource.ProjectFinished += OnProjectFinished;
7070
eventSource.AnyEventRaised += OnAnyEventRaised;
7171
}
7272

73-
/// <inheritdoc cref="ILogger.Shutdown"/>
73+
/// <inheritdoc cref="ILogger.Shutdown" />
7474
public void Shutdown()
7575
{
7676
}

src/Microsoft.Build.Utilities.ProjectCreation/ExtensionMethods.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ namespace Microsoft.Build.Utilities.ProjectCreation
1313
/// <summary>
1414
/// Provides extension methods.
1515
/// </summary>
16-
internal static class ExtensionMethods
16+
public static class ExtensionMethods
1717
{
1818
/// <summary>
19-
/// Gets the current object as an <see cref="IEnumerable{T}"/>.
19+
/// Gets the current object as an <see cref="IEnumerable{T}" />.
2020
/// </summary>
2121
/// <typeparam name="T">The type of the object.</typeparam>
22-
/// <param name="item">The item to make into an <see cref="IEnumerable{T}"/>.</param>
23-
/// <returns>The current object as an <see cref="IEnumerable{T}"/>.</returns>
22+
/// <param name="item">The item to make into an <see cref="IEnumerable{T}" />.</param>
23+
/// <returns>The current object as an <see cref="IEnumerable{T}" />.</returns>
2424
[DebuggerStepThrough]
2525
public static IEnumerable<T> AsEnumerable<T>(this T? item)
2626
where T : class
@@ -42,7 +42,7 @@ public static IEnumerable<T> AsEnumerable<T>(this T? item)
4242
/// </summary>
4343
/// <param name="first">The first dictionary and all of its values to start with.</param>
4444
/// <param name="second">The second dictionary to merge with the first and override its values.</param>
45-
/// <returns>A merged <see cref="IDictionary{String,String}"/> with the values of the first dictionary overridden by the second.</returns>
45+
/// <returns>A merged <see cref="IDictionary{String,String}" /> with the values of the first dictionary overridden by the second.</returns>
4646
[DebuggerStepThrough]
4747
public static IDictionary<string, string?> Merge(this IDictionary<string, string?>? first, IDictionary<string, string?> second)
4848
{
@@ -54,8 +54,8 @@ public static IEnumerable<T> AsEnumerable<T>(this T? item)
5454
/// </summary>
5555
/// <param name="first">The first dictionary and all of its values to start with.</param>
5656
/// <param name="second">The second dictionary to merge with the first and override its values.</param>
57-
/// <param name="comparer">The <see cref="IEqualityComparer{String}"/> implementation to use when comparing keys, or null to use the default <see cref="IEqualityComparer{String}"/> for the type of the key. </param>
58-
/// <returns>A merged <see cref="IDictionary{String,String}"/> with the values of the first dictionary overridden by the second.</returns>
57+
/// <param name="comparer">The <see cref="IEqualityComparer{String}" /> implementation to use when comparing keys, or null to use the default <see cref="IEqualityComparer{String}" /> for the type of the key. </param>
58+
/// <returns>A merged <see cref="IDictionary{String,String}" /> with the values of the first dictionary overridden by the second.</returns>
5959
[DebuggerStepThrough]
6060
public static IDictionary<string, string?> Merge(this IDictionary<string, string?>? first, IDictionary<string, string?> second, IEqualityComparer<string> comparer)
6161
{
@@ -93,7 +93,8 @@ public static T[] ToArrayWithSingleElement<T>(this T item)
9393
/// <param name="packageTypes">An <see cref="IEnumerable{String}" /> containing package types.</param>
9494
/// <returns>An <see cref="IEnumerable{PackageType}" /> containing the package types.</returns>
9595
/// <exception cref="ArgumentOutOfRangeException">Any package types are invalid.</exception>
96-
public static IEnumerable<PackageType> ToPackageTypes(this IEnumerable<string>? packageTypes)
96+
[DebuggerStepThrough]
97+
internal static IEnumerable<PackageType> ToPackageTypes(this IEnumerable<string>? packageTypes)
9798
{
9899
if (packageTypes == null)
99100
{

src/Microsoft.Build.Utilities.ProjectCreation/MSBuildAssemblyResolver.netcoreapp3.1.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace Microsoft.Build.Utilities.ProjectCreation
1414
public static partial class MSBuildAssemblyResolver
1515
{
1616
/// <summary>
17-
/// A <see cref="ResolveEventHandler"/> for MSBuild related assemblies.
17+
/// A <see cref="ResolveEventHandler" /> for MSBuild related assemblies.
1818
/// </summary>
1919
/// <param name="sender">The source of the event.</param>
2020
/// <param name="args">The event data.</param>

src/Microsoft.Build.Utilities.ProjectCreation/MSBuildAssemblyResolver.netframework.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public static partial class MSBuildAssemblyResolver
6767
private static readonly char[] PathSplitChars = { Path.PathSeparator };
6868

6969
/// <summary>
70-
/// A <see cref="ResolveEventHandler"/> for MSBuild related assemblies.
70+
/// A <see cref="ResolveEventHandler" /> for MSBuild related assemblies.
7171
/// </summary>
7272
/// <param name="sender">The source of the event.</param>
7373
/// <param name="args">The event data.</param>

src/Microsoft.Build.Utilities.ProjectCreation/PackageFeed.Items.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ public partial class ProjectCreator
1515
/// <param name="includeAssets">An optional value specifying which assets belonging to the package should be consumed.</param>
1616
/// <param name="excludeAssets">An optional value specifying which assets belonging to the package should be not consumed.</param>
1717
/// <param name="privateAssets">An optional value specifying which assets belonging to the package should not flow to dependent projects.</param>
18-
/// <param name="metadata">An optional <see cref="IDictionary{String,String}"/> containing metadata for the item.</param>
18+
/// <param name="metadata">An optional <see cref="IDictionary{String,String}" /> containing metadata for the item.</param>
1919
/// <param name="condition">An optional condition to add to the item.</param>
2020
/// <param name="label">An optional label to add to the item.</param>
21-
/// <returns>The current <see cref="ProjectCreator"/>.</returns>
21+
/// <returns>The current <see cref="ProjectCreator" />.</returns>
2222
public ProjectCreator ItemPackageReference(Package package, string? includeAssets = null, string? excludeAssets = null, string? privateAssets = null, IDictionary<string, string?>? metadata = null, string? condition = null, string? label = null)
2323
{
2424
return ItemPackageReference(package.Id, package.Version, includeAssets, excludeAssets, privateAssets, metadata, condition, label);

0 commit comments

Comments
 (0)