Skip to content

Allow referencing virtual projects#13389

Open
jjonescz wants to merge 2 commits intodotnet:mainfrom
jjonescz:virtual-proj-ref
Open

Allow referencing virtual projects#13389
jjonescz wants to merge 2 commits intodotnet:mainfrom
jjonescz:virtual-proj-ref

Conversation

@jjonescz
Copy link
Member

Part of dotnet/sdk#53478.

@jjonescz jjonescz marked this pull request as ready for review March 16, 2026 14:16
Copilot AI review requested due to automatic review settings March 16, 2026 14:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Enables ProjectReference to work with virtual (in-memory) projects when _BuildNonexistentProjectsByDefault is enabled, supporting SDK scenarios like file-based apps that synthesize projects into the ProjectRootElementCache.

Changes:

  • Update _SplitProjectReferencesByFileExistence to treat all ProjectReference items as “existent” when _BuildNonexistentProjectsByDefault=true.
  • Add unit tests validating both the split behavior and end-to-end ResolveProjectReferences behavior with in-memory projects.
  • Extend the spec to document ProjectReference behavior and virtual project limitations (notably out-of-proc node isolation).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/Tasks/Microsoft.Common.CurrentVersion.targets Bypasses Exists() classification for project references when building nonexistent projects by default, enabling virtual references.
src/Build.UnitTests/BackEnd/MSBuild_Tests.cs Adds coverage for virtual ProjectReference behavior (split + end-to-end build).
documentation/specs/build-nonexistent-projects-by-default.md Documents new ProjectReference behavior and clarifies constraints for virtual projects.

You can also share your feedback on Copilot code review. Take the survey.

@jjonescz
Copy link
Member Author

jjonescz commented Mar 23, 2026

@dotnet/msbuild for a review of this simple change that would allow us to implement #:ref support for file-based apps; thanks!

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.

2 participants