Skip to content

Ship TaskAnalyzer as a separate package with safe defaults - #15045

Merged
VolPlita merged 6 commits into
dotnet:mainfrom
VolPlita:taskanalyzer-shipping-package-fresh
Sep 30, 2026
Merged

VolPlita merged 6 commits into
dotnet:mainfrom
VolPlita:taskanalyzer-shipping-package-fresh

Conversation

@VolPlita

@VolPlita VolPlita commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

This PR ships the TaskAnalyzer as a separate Microsoft.Build.TaskAuthoring.Analyzer package and declares the dependency from Microsoft.Build.Framework for build-time analyzer consumption. This keeps analyzer updates independent from MSBuild API versioning while preserving compatibility for older hosts.

Scope:

  • ship the analyzer as a separate package
  • keep the default task-authoring diagnostics safe and non-breaking for regular tasks
  • require opt-in migration configuration for broader MT-style analysis
  • update package metadata and docs to match the shipped package model

Fixes #15035

Copilot AI lite review requested due to automatic review settings September 16, 2026 10:35
@VolPlita
VolPlita deployed to copilot-pat-pool September 16, 2026 10:35 — with GitHub Actions Active
@VolPlita
VolPlita deployed to copilot-pat-pool September 16, 2026 10:36 — with GitHub Actions Active

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Critical package-consumption validation and related documentation and release-tracking updates remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

This PR packages TaskAnalyzer with Microsoft.Build.Framework under analyzers/dotnet/cs and enables its shipping configuration.

Changes:

  • Adds the analyzer to the Framework package.
  • Enables shipping configuration.
  • Updates TaskAnalyzer delivery documentation.
File summaries
File Review result
src/TaskAnalyzer/TaskAnalyzer.csproj Enables shipping configuration. Nit (2 votes): release tracking still marks all rules unshipped.
src/TaskAnalyzer/README.md Nit (3 votes): documentation conflicts with the bundled-package model and should distinguish direct references.
src/Framework/Microsoft.Build.Framework.csproj Critical (3 votes): lacks package-consumption validation. Nit (1 vote): the Framework package README does not document the bundled analyzer.
Review details

Suppressed comments (2)

src/Framework/Microsoft.Build.Framework.csproj:105

  • The package README is src/Framework/README.md (Directory.Build.targets sets PackageReadmeFile to README.md), but this change only updates TaskAnalyzer/README.md. A consumer installing Microsoft.Build.Framework therefore gets no documentation of the analyzer, its default MT-only scope, migration option, suppression, or warnings-as-errors behavior. Add this guidance to the Framework package README or link to packaged documentation.
    <!-- Ship the TaskAnalyzer alongside the framework package so consumers receive it without a direct analyzer package reference. -->
    <None Include="$(ArtifactsBinDir)TaskAnalyzer\$(Configuration)\netstandard2.0\Microsoft.Build.TaskAuthoring.Analyzer.dll"
          Pack="true"
          PackagePath="analyzers\dotnet\cs\Microsoft.Build.TaskAuthoring.Analyzer.dll" />

src/Framework/Microsoft.Build.Framework.csproj:105

  • Placing this DLL under analyzers/dotnet/cs makes every existing Microsoft.Build.Framework PackageReference activate diagnostics automatically. The analyzer has warning rules that apply to regular tasks (MSBuildTask0004 and transitive MSBuildTask0005), while the WarningsNotAsErrors exception exists only in the in-repo Tasks project; existing consumer builds using TreatWarningsAsErrors can therefore start failing on a Framework package update. This needs an explicit opt-out/ChangeWave or another opt-in activation path, plus an opt-out test, before shipping.
    <None Include="$(ArtifactsBinDir)TaskAnalyzer\$(Configuration)\netstandard2.0\Microsoft.Build.TaskAuthoring.Analyzer.dll"
          Pack="true"
          PackagePath="analyzers\dotnet\cs\Microsoft.Build.TaskAuthoring.Analyzer.dll" />
  • Files reviewed: 3/3 changed files
  • Comments generated: 3
  • Review effort level: Lite

Comment thread src/Framework/Microsoft.Build.Framework.csproj Outdated
Comment thread src/TaskAnalyzer/README.md Outdated
Comment thread src/TaskAnalyzer/TaskAnalyzer.csproj
@VolPlita
VolPlita deployed to copilot-pat-pool September 16, 2026 11:07 — with GitHub Actions Active
@VolPlita
VolPlita deployed to copilot-pat-pool September 16, 2026 11:07 — with GitHub Actions Active
@VolPlita
VolPlita deployed to copilot-pat-pool September 16, 2026 11:08 — with GitHub Actions Active
@baronfel

Copy link
Copy Markdown
Member

I do not think we want to ship the analyzers directly with Microsoft.Build.Framework - this prevents folks that are using older versions of the MSBuild APIs (i.e. for compatibility with older MSBuild hosts) from using newer versions of the analyzers, which still might find useful issues for them to solve.

@VolPlita VolPlita changed the title Ship TaskAnalyzer through Microsoft.Build.Framework Ship TaskAnalyzer as a separate package with safe defaults Sep 18, 2026
@VolPlita
VolPlita force-pushed the taskanalyzer-shipping-package-fresh branch from 1606fe5 to 031fbc5 Compare September 23, 2026 09:25
@VolPlita
VolPlita requested a review from baronfel September 23, 2026 09:26
@VolPlita
VolPlita force-pushed the taskanalyzer-shipping-package-fresh branch from 031fbc5 to e4551cb Compare September 23, 2026 13:24
@baronfel

Copy link
Copy Markdown
Member

This looks pretty good to me. Specific requests:

  • make the analyze package versioning 0.1.0 - we can always change our versioning to align with MSbuild overall later, and that is easier than going to 18.x to 1.x. versions at a later date.
  • ensure that building local versions of the repo results in package versions with SHAs so that package references for locally-built packages do not clobber 'stable' versions

@VolPlita

VolPlita commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor Author

Implemented the requested package changes in 73e86ae

  • TaskAnalyzer now uses independent 0.1.0 versioning.
  • Local package versions append the short commit SHA, for example 0.1.0-dev..73e86aee12, to prevent NuGet cache collisions.
  • Added a generated-package contract test that validates the analyzer path, dependencies, README, icon, description, repository metadata, Framework PrivateAssets behavior, and explicit consumer activation.
  • Updated release and package documentation for the standalone explicit-install model.

Validated with the full repository build and all 369 TaskAnalyzer tests.

@VolPlita
VolPlita force-pushed the taskanalyzer-shipping-package-fresh branch from 73e86ae to 8d8639e Compare September 29, 2026 07:31
VolPlita and others added 4 commits September 29, 2026 13:29
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Start the analyzer package at 0.1.0, add commit SHAs to local package versions, and validate the generated package contract.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@VolPlita
VolPlita force-pushed the taskanalyzer-shipping-package-fresh branch from 8d8639e to e9d2a15 Compare September 29, 2026 11:29
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@VolPlita
VolPlita enabled auto-merge (squash) September 29, 2026 21:02
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@VolPlita
VolPlita merged commit 13a3659 into dotnet:main Sep 30, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ship the MSBuild task-authoring analyzers through Microsoft.Build.Framework

3 participants