Skip to content

Bundle Roslyn ProjectData tasks and import them through the SDK - #56243

Merged
jasonmalinowski merged 5 commits into
mainfrom
copilot/update-repo-to-consume-nuget-package
Sep 18, 2026
Merged

jasonmalinowski merged 5 commits into
mainfrom
copilot/update-repo-to-consume-nuget-package

Conversation

Copilot AI commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Bundle Roslyn’s Microsoft.NET.ProjectData.Tasks and import its targets through the SDK so projects can generate project data without adding a package reference or custom import. This integrates the package introduced in dotnet/dotnet#9362.

The tasks, targets, schema, and runtime dependencies are shipped together in the SDK’s ProjectData directory. Generation during normal builds remains opt-in through EnableProjectDataOnBuild, with integration coverage for single- and multi-targeted projects.

Copilot AI lite review requested due to automatic review settings September 16, 2026 22:35

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

The bundled task runtime may be omitted, and multi-target coverage does not fully validate merged project data.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Bundles Roslyn ProjectData tasks and targets into the SDK for opt-in project-data generation without custom package references or imports.

Changes:

  • Adds ProjectData dependency and centralized versioning.
  • Publishes and imports ProjectData assets through the SDK layout.
  • Adds single- and multi-target integration coverage.
File summaries
File Summary
test/Microsoft.NET.Build.Tests/GivenThatWeWantToUseProjectData.cs Adds ProjectData build tests.
src/Tasks/Microsoft.NET.Build.Tasks/sdk/Sdk.targets Imports bundled ProjectData targets.
src/Layout/redist/tools/tool_projectdata.csproj Defines the ProjectData bundle.
src/Layout/redist/targets/GenerateLayout.targets Publishes ProjectData into the SDK layout.
src/Layout/redist/redist.csproj Adds the bundle project reference.
eng/Version.Details.xml Registers the dependency version and source.
eng/Version.Details.props Defines ProjectData version properties.
Directory.Packages.props Centrally versions the package.
Review details

Suppressed comments (1)

test/Microsoft.NET.Build.Tests/GivenThatWeWantToUseProjectData.cs:36

  • The multiTarget cases only assert that a non-empty merged .lscache exists. A regression in the cross-targeting merge/dispatch path could still write a valid non-empty cache from one TFM (or only the outer project) and pass this test, so the new multi-target coverage would not prove the behavior described by the test name. Add an assertion against the cache's structured contents (or another observable marker) that both TargetFrameworks values are present in the merged project data.
        string projectDataPath = Path.Combine(testAsset.Path, testProject.Name, $"{testProject.Name}.csproj.lscache");
        File.Exists(projectDataPath).Should().Be(enabled);
        if (enabled)
        {
            new FileInfo(projectDataPath).Length.Should().BeGreaterThan(0);
  • Files reviewed: 8/8 changed files
  • Comments generated: 1
  • Review effort level: Lite

@baronfel baronfel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, sorry for the delay here.

@jasonmalinowski
jasonmalinowski merged commit 7d46d29 into main Sep 18, 2026
29 checks passed
@jasonmalinowski
jasonmalinowski deleted the copilot/update-repo-to-consume-nuget-package branch September 18, 2026 20:43
@jasonmalinowski

Copy link
Copy Markdown
Member

/backport to release/11.0.1xx

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/11.0.1xx (link to workflow run)

@github-actions

Copy link
Copy Markdown
Contributor

@jasonmalinowski backporting to release/11.0.1xx failed, the patch most likely resulted in conflicts. Please backport manually!

git am output
$ git cherry-pick 7d46d29649c386ab78235be51220cdda736ed9b1

Auto-merging Directory.Packages.props
Auto-merging eng/Version.Details.props
CONFLICT (content): Merge conflict in eng/Version.Details.props
Auto-merging eng/Version.Details.xml
error: could not apply 7d46d29649... Bundle Roslyn ProjectData tasks and import them through the SDK (#56243)
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
hint: Disable this message with "git config set advice.mergeConflict false"


$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Applying: Bundle Roslyn ProjectData tasks using a Container-style SDK layout
Using index info to reconstruct a base tree...
M	eng/Version.Details.props
M	eng/Version.Details.xml
Falling back to patching base and 3-way merge...
Auto-merging eng/Version.Details.props
CONFLICT (content): Merge conflict in eng/Version.Details.props
Auto-merging eng/Version.Details.xml
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Bundle Roslyn ProjectData tasks using a Container-style SDK layout
Error: The process '/usr/bin/git' failed with exit code 128

Link to workflow output

jasonmalinowski pushed a commit to jasonmalinowski/sdk that referenced this pull request Sep 18, 2026
…et#56243)

This bundles the ProjectData/lscache tests into the SDK, so lscache files can be generated if EnableProjectDataOnBuild is enabled.
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Sep 22, 2026
nagilson added a commit that referenced this pull request Sep 24, 2026
Problem:
Every build leg of this codeflow fails with MSB3030:
  Could not copy ".packages/microsoft.net.projectdata.tasks/5.12.0-1.26473.115/
  lib/netstandard2.0/Microsoft.NET.ProjectData.targets" (and .Schema.props)
  because it was not found.

Root cause:
tool_projectdata.csproj (added in #56243) copies the ProjectData targets and
schema props from a hardcoded lib/netstandard2.0/ folder in the
Microsoft.NET.ProjectData.Tasks package. Roslyn (flowed via dotnet/dotnet#9648)
retargeted Microsoft.NET.ProjectData.Tasks from netstandard2.0 to
$(NetRoslynSourceBuild) and packs these files under lib\$(TargetFramework)\.
Package 5.12.0-1.26473.115 therefore ships them in lib/net10.0/ (the
source-only build uses $(NetCurrent)), so the hardcoded path no longer exists.

Fix:
- Glob lib/*/ for the two files so the layout does not depend on the TFM
  Roslyn builds the task package for.
- Add a build-time check that exactly the two expected files were found.
  Sdk.targets imports Microsoft.NET.ProjectData.targets only if it exists,
  so without this check a future package layout change would silently
  disable the feature instead of failing the build.

Validation:
- Reproduced the MSB3030 locally at the PR head.
- With the fix, publishing tool_projectdata.csproj produces
  Microsoft.NET.ProjectData.{targets,Schema.props,Tasks.dll}; the targets
  load the task via $(MSBuildThisFileDirectory), so the layout is intact.
- Overriding the package path to a missing folder hits the new error.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 5d7abc6b-347c-43e3-93cb-c75ee7b81f93
nagilson added a commit that referenced this pull request Oct 23, 2026
…elease/11.0.1xx-to-release/11.0.2xx

Conflict resolutions:
- sdk.slnx, dotnet.csproj: keep Microsoft.DotNet.Cli.InternalMicrosoft (2xx, #56458); drop
  Microsoft.DotNet.Cli.Telemetry (removed in 1xx by #56274, replaced by Azure Monitor exporter 1.10.0).
- Program.cs: combine 1xx exit-code-aware shutdown drain with 2xx internal-Microsoft detection wait.
- Versions.props: take 1xx runtime version features (#56629: 8.0.33, 9.0.22, 10.0.MinorPatch+14) and
  restore 11.0.2xx preview band branding to match dotnet/dotnet#9512 (VersionSDKMinor 2, patch 00,
  preview label, empty iteration) instead of the auto-merged 1xx rtm label.

Fixes for files reset to release/11.0.2xx by the flow bot:
- Add Microsoft.NET.ProjectData.Tasks 5.13.0-1.26508.107 dependency (needed by #56243 from 1xx).
- Disable central transitive pinning in tool_projectdata (content-only harvest) so the 2xx ProjectData
  package's NuGet.Versioning floor does not conflict with the 2xx NuGet band.
- Update testfx dependencies to 1xx versions (MSTest 4.5.0-preview.26477.3, MTP 2.5.0-preview.26477.3)
  needed by 1xx HotReload.Client tests (#56609).

Co-authored-by: Copilot <[email protected]>
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.

6 participants