Back to Msbuild

MSBuild Visual Studio Telemetry Data

documentation/VS-Telemetry-Data.md

18.4.06.6 KB
Original Source

MSBuild Visual Studio Telemetry Data

This document describes the telemetry data collected by MSBuild and sent to Visual Studio telemetry infrastructure. The telemetry helps the MSBuild team understand build patterns, identify issues, and improve the build experience.

Overview

MSBuild collects telemetry at multiple levels:

  1. Build-level telemetry - Overall build metrics and outcomes
  2. Task-level telemetry - Information about task execution
  3. Target-level telemetry - Information about target execution and incrementality
  4. Error categorization telemetry - Classification of build failures

All telemetry events use the VS/MSBuild/ prefix as required by VS exporting/collection. Properties use the VS.MSBuild. prefix.


1. Build Telemetry (build event)

The primary telemetry event capturing overall build information.

Properties

PropertyTypeDescription
BuildDurationInMillisecondsdoubleTotal build duration from start to finish
InnerBuildDurationInMillisecondsdoubleDuration from when BuildManager starts (excludes server connection time)
BuildEngineHoststringHost environment: "VS", "VSCode", "Azure DevOps", "GitHub Action", "CLI", etc.
BuildSuccessboolWhether the build succeeded
BuildTargetstringThe target(s) being built
BuildEngineVersionVersionMSBuild engine version
BuildEngineDisplayVersionstringDisplay-friendly engine version
BuildEngineFrameworkNamestringRuntime framework name
BuildCheckEnabledboolWhether BuildCheck (static analysis) was enabled
MultiThreadedModeEnabledboolWhether multi-threaded build mode was enabled
SACEnabledboolWhether Smart Application Control was enabled
IsStandaloneExecutionboolTrue if MSBuild runs from command line
InitialMSBuildServerStatestringServer state before build: "cold", "hot", or null
ServerFallbackReasonstringIf server was bypassed: "ServerBusy", "ConnectionError", or null
ProjectPathstringPath to the project file being built
FailureCategorystringPrimary failure category when build fails (see Error Categorization)
ErrorCountsobjectBreakdown of errors by category (see Error Categorization)

2. Error Categorization

When a build fails, errors are categorized to help identify the source of failures.

Error Categories

CategoryError Code PrefixesDescription
CompilerCS, FS, VBCC#, F#, and Visual Basic compiler errors
MsBuildGeneralMSB4001-MSB4099, MSB4500-MSB4999General MSBuild errors
MsBuildEvaluationMSB4100-MSB4199Project evaluation errors
MsBuildExecutionMSB4300-MSB4399, MSB5xxx-MSB6xxxBuild execution errors
MsBuildGraphMSB4400-MSB4499Static graph build errors
TaskMSB3xxxTask-related errors
SdkResolversMSB4200-MSB4299SDK resolution errors
NetSdkNETSDK.NET SDK errors
NuGetNUNuGet package errors
BuildCheckBCBuildCheck rule violations
NativeToolchainLNK, C1xxx-C4xxx, CLNative C/C++ toolchain errors (linker, compiler)
CodeAnalysisCA, IDECode analysis and IDE analyzer errors
RazorRZRazor compilation errors
WpfXC, MCWPF/XAML compilation errors
AspNetASP, BLASP.NET and Blazor errors
Other(all others)Uncategorized errors

3. Task Telemetry

Task Factory Event (build/tasks/taskfactory)

Tracks which task factories are being used.

PropertyTypeDescription
AssemblyTaskFactoryTasksExecutedCountintTasks loaded via AssemblyTaskFactory
IntrinsicTaskFactoryTasksExecutedCountintBuilt-in intrinsic tasks
CodeTaskFactoryTasksExecutedCountintTasks created via CodeTaskFactory
RoslynCodeTaskFactoryTasksExecutedCountintTasks created via RoslynCodeTaskFactory
XamlTaskFactoryTasksExecutedCountintTasks created via XamlTaskFactory
CustomTaskFactoryTasksExecutedCountintTasks from custom task factories

4. Build Incrementality Telemetry

Classifies builds as full or incremental based on target execution patterns.

Incrementality Info (Activity Property)

FieldTypeDescription
ClassificationenumFull, Incremental, or Unknown
TotalTargetsCountintTotal number of targets
ExecutedTargetsCountintTargets that ran
SkippedTargetsCountintTargets that were skipped
SkippedDueToUpToDateCountintSkipped because outputs were current
SkippedDueToConditionCountintSkipped due to false condition
SkippedDueToPreviouslyBuiltCountintSkipped because already built
IncrementalityRatiodoubleRatio of skipped to total (0.0-1.0)

A build is classified as Incremental when more than 70% of targets are skipped.


Privacy Considerations

Data Hashing

Custom and potentially sensitive data is hashed using SHA-256 before being sent:

  • Custom task names - Hashed to protect proprietary task names
  • Custom target names - Hashed to protect proprietary target names
  • Custom task factory names - Hashed if not in the known list
  • Metaproj target names - Hashed to protect solution structure

Known Task Factory Names (Not Hashed)

The following Microsoft-owned task factory names are sent in plain text:

  • AssemblyTaskFactory
  • TaskHostFactory
  • CodeTaskFactory
  • RoslynCodeTaskFactory
  • XamlTaskFactory
  • IntrinsicTaskFactory
FileDescription
BuildTelemetry.csMain build telemetry class
BuildInsights.csContainer for detailed insights
TelemetryDataUtils.csData transformation utilities
BuildErrorTelemetryTracker.csError categorization
ProjectTelemetry.csPer-project task telemetry
LoggingConfigurationTelemetry.csLogger configuration
BuildCheckTelemetry.csBuildCheck telemetry
KnownTelemetry.csStatic telemetry accessors
TelemetryConstants.csTelemetry naming constants