Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
58aeab6
Add telemetry logger support for API-based MSBuild usage
Copilot Sep 30, 2025
0b8fb6f
Add tests for ProjectInstanceExtensions telemetry logger creation
Copilot Sep 30, 2025
c37c61a
Fix telemetry logger to use distributed logging pattern with central …
Copilot Sep 30, 2025
1dc7f54
Fix ForwardingLoggerRecord to use central logger instance with forwar…
Copilot Sep 30, 2025
c201734
Share telemetry central logger instance between ProjectCollection and…
Copilot Sep 30, 2025
6d409d6
Add integration test for telemetry logger receiving events from API-b…
Copilot Sep 30, 2025
51f1399
Add telemetry logger support to VirtualProjectBuildingCommand
Copilot Oct 1, 2025
9343a69
Add telemetry logger support to PackageAddCommand for project evaluation
Copilot Oct 1, 2025
65f60f0
Add BannedApiAnalyzer to prevent direct MSBuild API usage without tel…
Copilot Nov 4, 2025
102371a
Scope BannedApiAnalyzer to src/Cli and fix all ProjectCollection viol…
Copilot Nov 4, 2025
3cd34a8
Use version property for BannedApiAnalyzers and update copilot-instru…
Copilot Nov 7, 2025
3093c60
Remove formatting-only changes to reduce PR noise
Copilot Nov 20, 2025
31e17b7
Restore BuildFinished event registration outside telemetry check
Copilot Nov 20, 2025
6eb6064
Revert accidental removal of functional code in TestCommand and telem…
Copilot Nov 20, 2025
243ad7f
react to changes post-rebase
baronfel Nov 21, 2025
151ef1a
Add unification plan document
baronfel Nov 23, 2025
bb53470
update local build instructions for copilot
baronfel Nov 23, 2025
ef5751b
big giant refactor towards more explicit types
baronfel Nov 24, 2025
5825147
Update some RunCommand infrastructure
baronfel Nov 25, 2025
6de6502
Tweak
baronfel Nov 25, 2025
ea3fc88
a lot more consolidation
baronfel Nov 25, 2025
ea27e91
finally plumb through centralizing on DotNetProject
baronfel Nov 29, 2025
4540b6a
update runcommand target framework selection to use evaluator
baronfel Nov 30, 2025
d3b9d3d
react to rebase
baronfel Dec 5, 2025
d2a96eb
prevent some duplicate loads when using the raw methods of the evaluator
baronfel Dec 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Tweak
  • Loading branch information
baronfel committed Dec 5, 2025
commit 6de650217f533c266cb0d2522cdca35a61fb0415
23 changes: 4 additions & 19 deletions BannedSymbols.txt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does the use of projectInstance.Build in ProjectInstanceExtensions.cs not trigger this check? I don't seem something that excludes that file from this check.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect it's because we're not blocking the entire method and instead only specific overloads.

A better approach would be to block the entire method groups/types and force callsites that needed them (like our wrapper types) to explicitly nowarn.

Original file line number Diff line number Diff line change
@@ -1,24 +1,9 @@
# Ban direct usage of MSBuild APIs to ensure proper telemetry integration and evaluation caching
# Use DotNetProjectEvaluator and DotNetProjectBuilder wrapper types instead

# Ban direct ProjectInstance creation - use DotNetProjectEvaluator.LoadProject instead
M:Microsoft.Build.Execution.ProjectInstance.#ctor(System.String);Use DotNetProjectEvaluator.LoadProject() instead
M:Microsoft.Build.Execution.ProjectInstance.#ctor(System.String,System.Collections.Generic.IDictionary`2<System.String,System.String>,System.String);Use DotNetProjectEvaluator.LoadProject() instead
M:Microsoft.Build.Execution.ProjectInstance.#ctor(System.String,System.Collections.Generic.IDictionary`2<System.String,System.String>,System.String,Microsoft.Build.Evaluation.ProjectCollection);Use DotNetProjectEvaluator.LoadProject() instead

# Ban direct ProjectInstance.Build() methods - use DotNetProjectBuilder instead
M:Microsoft.Build.Execution.ProjectInstance.Build();Use DotNetProjectBuilder.Build() instead
M:Microsoft.Build.Execution.ProjectInstance.Build(System.String[]);Use DotNetProjectBuilder.Build() instead
M:Microsoft.Build.Execution.ProjectInstance.Build(System.String[],System.Collections.Generic.IEnumerable`1<Microsoft.Build.Framework.ILogger>);Use DotNetProjectBuilder.Build() instead
M:Microsoft.Build.Execution.ProjectInstance.Build(System.String[],System.Collections.Generic.IEnumerable`1<Microsoft.Build.Framework.ILogger>,System.Collections.Generic.IEnumerable`1<Microsoft.Build.Logging.ForwardingLoggerRecord>);Use DotNetProjectBuilder.Build() instead

# Ban direct Project.Build() methods - use DotNetProjectBuilder instead
M:Microsoft.Build.Evaluation.Project.Build();Use DotNetProjectBuilder.Build() instead
M:Microsoft.Build.Evaluation.Project.Build(Microsoft.Build.Framework.ILogger);Use DotNetProjectBuilder.Build() instead
M:Microsoft.Build.Evaluation.Project.Build(System.String);Use DotNetProjectBuilder.Build() instead
M:Microsoft.Build.Evaluation.Project.Build(System.String[]);Use DotNetProjectBuilder.Build() instead
# Ban direct project creation/manipulation
T:Microsoft.Build.Execution.ProjectInstance;Use DotNetProjectEvaluator.LoadProject() to get a DotNetProject instead
T:Microsoft.Build.Evaluation.Project;Use DotNetProjectEvaluator.LoadProject() to get a DotNetProject instead

# Ban direct ProjectCollection creation - use DotNetProjectEvaluatorFactory instead
M:Microsoft.Build.Evaluation.ProjectCollection.#ctor();Use DotNetProjectEvaluatorFactory.Create() or CreateForCommand() instead
M:Microsoft.Build.Evaluation.ProjectCollection.#ctor(System.Collections.Generic.IDictionary`2<System.String,System.String>);Use DotNetProjectEvaluatorFactory.Create() instead
M:Microsoft.Build.Evaluation.ProjectCollection.#ctor(Microsoft.Build.Evaluation.ToolsetDefinitionLocations);Use DotNetProjectEvaluatorFactory.Create() instead
T:Microsoft.Build.Evaluation.ProjectCollection;Use DotNetProjectEvaluatorFactory to get a DotNetProjectEvaluator instead
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ internal sealed class MSBuildForwardingAppWithoutLogging
private static readonly bool UseMSBuildServer = Env.GetEnvironmentVariableAsBool("DOTNET_CLI_USE_MSBUILD_SERVER", false);
private static readonly string? TerminalLoggerDefault = Env.GetEnvironmentVariable("DOTNET_CLI_CONFIGURE_MSBUILD_TERMINAL_LOGGER");

public static string MSBuildVersion
{
get => Microsoft.Build.Evaluation.ProjectCollection.DisplayVersion;
}
#pragma warning disable RS0030 // This usage of ProjectCollection is OK because we're only using its DisplayVersion property.
public static string MSBuildVersion => Microsoft.Build.Evaluation.ProjectCollection.DisplayVersion;
#pragma warning restore RS0030 // Do not use banned APIs

private const string MSBuildExeName = "MSBuild.dll";

private const string SdksDirectoryName = "Sdks";
Expand Down