Skip to content

Commit fb7514c

Browse files
Copilotjjonescz
authored andcommitted
Add telemetry logger support to VirtualProjectBuildingCommand
Co-authored-by: jjonescz <[email protected]>
1 parent e3dccd6 commit fb7514c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
using Microsoft.CodeAnalysis.Text;
2525
using Microsoft.DotNet.Cli.Commands.Clean.FileBasedAppArtifacts;
2626
using Microsoft.DotNet.Cli.Commands.Restore;
27+
using Microsoft.DotNet.Cli.Extensions;
2728
using Microsoft.DotNet.Cli.Utils;
2829
using Microsoft.DotNet.Cli.Utils.Extensions;
2930

@@ -297,14 +298,17 @@ public override int Execute()
297298

298299
// Set up MSBuild.
299300
ReadOnlySpan<ILogger> binaryLoggers = binaryLogger is null ? [] : [binaryLogger.Value];
300-
IEnumerable<ILogger> loggers = [.. binaryLoggers, consoleLogger];
301+
IEnumerable<ILogger> existingLoggers = [.. binaryLoggers, consoleLogger];
302+
303+
// Include telemetry logger for evaluation and capture it for potential future use
304+
var (loggersWithTelemetry, telemetryCentralLogger) = ProjectInstanceExtensions.CreateLoggersWithTelemetry(existingLoggers);
301305
var projectCollection = new ProjectCollection(
302306
MSBuildArgs.GlobalProperties,
303-
loggers,
307+
loggersWithTelemetry,
304308
ToolsetDefinitionLocations.Default);
305309
var parameters = new BuildParameters(projectCollection)
306310
{
307-
Loggers = loggers,
311+
Loggers = loggersWithTelemetry,
308312
LogTaskInputs = binaryLoggers.Length != 0,
309313
};
310314

0 commit comments

Comments
 (0)