Clean up some file-based app APIs#53056
Conversation
There was a problem hiding this comment.
Pull request overview
This PR turns Microsoft.DotNet.ProjectTools into a shipping, packable package and exposes a minimal public API (VirtualProjectBuilder) intended to generate MSBuild project representations for file-based apps (per NuGet/Home#14390).
Changes:
- Makes
Microsoft.DotNet.ProjectToolspackable/shipping and adds PublicAPI tracking files + repo-widerequire_api_filesenforcement. - Exposes
VirtualProjectBuilderpublicly and addsCreateProjectRootElement(...)to produce an MSBuildProjectRootElementfor a file-based program. - Narrows several previously-public helper types/APIs (launch settings + hashing) to
internaland updates CLI call sites for a newCreateProjectInstanceout parameter.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/dotnet-watch.Tests/dotnet-watch.Tests.csproj | Adds a compile-time Microsoft.Build reference for tests (excluding runtime assets). |
| src/Microsoft.DotNet.ProjectTools/VirtualProjectBuilder.cs | Publicizes the type and adds CreateProjectRootElement; threads ProjectRootElement out of project instance creation. |
| src/Microsoft.DotNet.ProjectTools/Utilities/Sha256Hasher.cs | Changes hasher to internal to reduce public surface. |
| src/Microsoft.DotNet.ProjectTools/PublicAPI.Unshipped.txt | Declares newly introduced public APIs for analyzer tracking. |
| src/Microsoft.DotNet.ProjectTools/PublicAPI.Shipped.txt | Adds baseline shipped API file header. |
| src/Microsoft.DotNet.ProjectTools/Microsoft.DotNet.ProjectTools.csproj | Marks project packable/shipping; adds PublicApiAnalyzers; adjusts dependencies and friend assemblies. |
| src/Microsoft.DotNet.ProjectTools/LaunchSettings/*.cs | Makes launch-settings model types internal to keep package surface small. |
| src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs | Updates call into VirtualProjectBuilder.CreateProjectInstance for new out param. |
| src/Cli/dotnet/Commands/Project/Convert/ProjectConvertCommand.cs | Updates call into VirtualProjectBuilder.CreateProjectInstance for new out param. |
| .editorconfig | Enables dotnet_public_api_analyzer.require_api_files = true. |
src/Microsoft.DotNet.ProjectTools/Microsoft.DotNet.ProjectTools.csproj
Outdated
Show resolved
Hide resolved
src/Microsoft.DotNet.ProjectTools/Microsoft.DotNet.ProjectTools.csproj
Outdated
Show resolved
Hide resolved
RikkiGibson
left a comment
There was a problem hiding this comment.
Done review pass. Tomas's feedback seems reasonable to me
|
I also have some minor changes to the APIs in the pipeline: https://github.com/dotnet/sdk/pull/52648/changes#diff-6d5af1d6629956acc8f719ba30bbfd461bb7a0757e22f2ac7ccffab8591a88fe Let me extract that to a separate PR. |
|
Here it is: #53088 I have reduced the API surface that we need to be exposed for dotnet-watch. Wanna cherry-pick my commit into this PR? |
|
Reverted changes related to publishing a package consumable by nuget CLI, so this is now just a small cleanup of the API, mostly for dotnet-watch. |
commit 3d009596d1c130ded9be7576d45a4e3cc8a31d41
Author: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Date: Thu Mar 12 08:10:03 2026 -0700
[sdk] Source update 6e514f6 → 8cbac4a
Diff: https://github.com/dotnet/sdk/compare/6e514f6189902a6422a6ab91324804c37035315b..8cbac4a5cdf27c2bb606a282cc47e60a7c4ced45
From: dotnet/sdk@6e514f6
To: dotnet/sdk@8cbac4a
[[ commit created by automation ]]
```
C:\sdk>darc vmr forwardflow --build 303236 --vmr C:\dotnet
info: Flowing build 20260224.4 (303236) of commit 8cbac4a...
info: Making sure commit '8cbac4a5cdf27c2bb606a282cc47e60a7c4ced45' is present in repository 'C:\sdk'...
info: Flowing sdk's commit 8cbac4a to VMR at C:\dotnet...
info: Last flow was back flow: d346a57 -> f284d9f49aec157d49233ab5785cbcf78ed1ea58
info: Current flow is in the opposite direction
info: Creating a working branch darc/forward/8cbac4a-d346a57
info: Synchronizing sdk from 6e514f6189902a6422a6ab91324804c37035315b to https://github.com/dotnet/sdk / 8cbac4a5cdf27c2bb606a282cc47e60a7c4ced45
info: Updating VMR sdk from 6e514f6 to 8cbac4a..
info: Rebasing darc/forward/8cbac4a-d346a57 onto UpdateSdk1...
info: Auto-resolving expected conflicts...
info: Successfully auto-resolved 1 expected conflicts
info: Resolving dependency updates in source 6e514f6189902a6422a6ab91324804c37035315b..HEAD and target d346a57..UpdateSdk1
info: Changes staged in C:\dotnet
info: PRs from original repository included in this codeflow update:
- dotnet/sdk#53090
- dotnet/sdk#52347
- dotnet/sdk#53100
- dotnet/sdk#53056
```
Narrows down the API surface used by dotnet-watch.
Originally needed for NuGet/Home#14390 but not anymore (need to choose a different approach to avoid a source-build-incompatible dependency sdk->nuget).