Skip to content

[vs18.12] Ship TaskAnalyzer as a separate package - #15176

Closed
VolPlita wants to merge 2 commits into
dotnet:vs18.12from
VolPlita:backport-task-analyzer-shipping-vs18.12
Closed

VolPlita wants to merge 2 commits into
dotnet:vs18.12from
VolPlita:backport-task-analyzer-shipping-vs18.12

Conversation

@VolPlita

Copy link
Copy Markdown
Contributor

Summary

Backports #15045 and #15146 to vs18.12.

  • Ships Microsoft.Build.TaskAuthoring.Analyzer as a separate, opt-in package.
  • Keeps Microsoft.Build.Framework from exposing or activating the analyzer transitively.
  • Removes the explicit Microsoft.CodeAnalysis.Analyzers 3.11.0 dependency that breaks source-build.
  • Includes package-contract tests and updated analyzer documentation.

Compatibility

This adds a new opt-in package and does not change existing build behavior. No ChangeWave is required.

Validation

  • .\build.cmd -v quiet
  • dotnet test src\TaskAnalyzer.Tests\TaskAnalyzer.Tests.csproj -c Release
    • 369 passed, 0 failed, 0 skipped

VolPlita and others added 2 commits September 30, 2026 16:58
)

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 dotnet#15035

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…otnet#15146)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 30, 2026 15:04
@VolPlita
VolPlita requested a review from a team as a code owner September 30, 2026 15:04
@VolPlita VolPlita mentioned this pull request Sep 30, 2026
4 of 9 tasks
@VolPlita

Copy link
Copy Markdown
Contributor Author

Closing because the vs18.12 backport is not wanted.

@VolPlita VolPlita closed this Sep 30, 2026
@VolPlita
VolPlita deleted the backport-task-analyzer-shipping-vs18.12 branch September 30, 2026 15:08

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.

Copilot review overview

🟡 Changes recommended

The documentation uses the wrong package release version and includes a broken migration-guide link.

Review effort: Balanced
Findings: 3 Low severity

Open (3)
What changed in this PR

Ships TaskAnalyzer as an independent, opt-in NuGet package without transitive Framework activation.

Changes:

  • Adds analyzer packaging metadata and release documentation.
  • Removes the explicit Roslyn analyzer dependency.
  • Adds package-contract and activation tests.
File Description
src/​TaskAnalyzer/​TaskAnalyzer.csproj Enables shipping the analyzer package.
src/​TaskAnalyzer/​README.md Documents package installation and links.
src/​TaskAnalyzer/​AnalyzerReleases.Unshipped.md Moves rules out of the unshipped manifest.
src/​TaskAnalyzer/​AnalyzerReleases.Shipped.md Records the initial shipped rules.
src/​TaskAnalyzer.Tests/​TaskAnalyzer.Tests.csproj Generates repository-path test constants.
src/​TaskAnalyzer.Tests/​PackageContractTests.cs Tests package contents and analyzer activation.
src/​Framework/​README.md Documents explicit analyzer installation.
src/​Framework/​Microsoft.Build.Framework.csproj Adds a private analyzer project reference.
eng/​dependabot/​Directory.Packages.props Removes the explicit Roslyn analyzer version.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@@ -1 +1,20 @@
; No shipped releases yet
## Release 18.13.0
```xml
<ItemGroup>
<PackageReference Include="Microsoft.Build.TaskAuthoring.Analyzer" Version="1.0.0"
<PackageReference Include="Microsoft.Build.TaskAuthoring.Analyzer" Version="18.13.0"
- [Migration Skill Guide](../../.github/skills/multithreaded-task-migration/SKILL.md)
- [IMultiThreadableTask Interface](https://github.com/dotnet/msbuild/blob/main/src/Framework/IMultiThreadableTask.cs)
- [TaskEnvironment Class](https://github.com/dotnet/msbuild/blob/main/src/Framework/TaskEnvironment.cs)
- [Migration Skill Guide](https://github.com/dotnet/msbuild/blob/main/.github/skills/multithreaded-task-migration/SKILL.md)

@github-actions github-actions Bot 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.

Test Coverage & Completeness found two concrete gaps: the package-contract test blesses repository-wide versioning instead of the requested independent 0.1.0/SHA-suffixed local contract, and its generated repo-root source disappears from incremental compilations when the generation target is skipped.

Warning

Firewall blocked 4 domains

The following domains were blocked by the firewall during workflow execution:

  • api.github.com
  • cafe.github.com
  • github.com
  • raw.githubusercontent.com

[!TIP]
api.github.com is blocked because GitHub API access uses the built-in GitHub tools by default. Instead of adding api.github.com to network.allowed, use tools.github.mode: gh-proxy for direct pre-authenticated GitHub CLI access without requiring network access to api.github.com:

tools:
  github:
    mode: gh-proxy

See GitHub Tools for more information on gh-proxy mode.

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "api.github.com"
    - "cafe.github.com"
    - "github.com"
    - "raw.githubusercontent.com"

See Network Configuration for more information.

Generated by Expert Code Review (on open) for #15176 · copilot · gpt56 · 1.1K AIC · ⌖ 5.58 AIC · ⊞ 24.4K

</GeneratedText>
<GeneratedFilePath>$(IntermediateOutputPath)TaskAnalyzerTestsConstants.cs</GeneratedFilePath>
</PropertyGroup>
<ItemGroup>

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.

This generated source is only added to Compile while the incremental target executes. Concrete repro: build the test project once, modify any .cs test file without changing the project/imports, then build again. TaskAnalyzerTestsConstants.cs is newer than $(MSBuildAllProjects), so this target is skipped; CoreCompile reruns for the changed source, but obj/** is excluded from default compile items and the generated file is absent, producing a missing TaskAnalyzerTestsConstants compile error. Declare the generated path/Compile item at evaluation time and leave only file generation in the target (or otherwise ensure the item is present when the target skips).


analyzerPackage.NuspecReader.GetIdentity().Version.ShouldBe(
frameworkPackage.NuspecReader.GetIdentity().Version,
"TaskAnalyzer should use the repository-wide package version.");

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.

The contract assertion verifies the opposite of the requested independent analyzer versioning. With this test, an analyzer package using the repository-wide 18.x Framework version passes, and two local packs from different commits can retain the same package version because nothing asserts a SHA suffix. Please assert the 0.1.0 analyzer version contract and that a local pack's normalized version includes the supplied SourceRevisionId short SHA; Framework equality should not be expected.

{
internal static class TaskAnalyzerTestsConstants
{
public const string RepoRoot = @"$(RepoRoot)"%3B

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.

A valid Unix checkout path containing " breaks this generated source. For example, with RepoRoot=/home/runner/msbuild"review/, the output becomes public const string RepoRoot = @"/home/runner/msbuild"review/";, so TaskAnalyzer.Tests fails to compile before the package-contract test runs. Please C#-escape the injected property (double " inside a verbatim literal), or pass the repository root without source generation.

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — e819c120 Deployed Sep 30, 2026 by VolPlita via conclusion #950
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.

3 participants