Implement #:ref directive for file-based apps#53291
Draft
jjonescz wants to merge 6 commits intodotnet:release/10.0.3xxfrom
Draft
Implement #:ref directive for file-based apps#53291jjonescz wants to merge 6 commits intodotnet:release/10.0.3xxfrom
jjonescz wants to merge 6 commits intodotnet:release/10.0.3xxfrom
Conversation
Add support for referencing one file-based app from another via the built as a library (OutputType=Library) using the existing virtual project infrastructure, and the output DLL is referenced via a <Reference HintPath=...> item in the referencing app's virtual project. Key changes: - Add CSharpDirective.Ref class with path resolution (similar to Project) - Register 'ref' in the directive parser switch - Handle Ref in VirtualProjectBuilder.EvaluateDirectives - Emit <Reference> items in WriteProjectFile for evaluated #:ref directives - Build referenced apps before main app in VirtualProjectBuildingCommand - Disable CSC cache optimization when #:ref is present - Convert #:ref to #:project in dotnet project convert - Add integration tests for basic ref, subdirectory ref, and error cases - Add resource strings for #:ref error messages - Update InternalAPI.Unshipped.txt and xlf files Related to dotnet#52532 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add a script for fast incremental iteration on specific SDK projects. Builds only specified projects and copies DLLs to the redist layout (~30s vs ~5min full build). Mention it in copilot-instructions.md. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add RefDirective test in DotnetProjectConvertTests verifying that #:ref lib.cs converts to a ProjectReference pointing to ../lib/lib.csproj. Add CscOnly_AfterMSBuild_RefDirective test verifying that CSC-only optimization is disabled when #:ref directives are present. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Verify that internals from a #:ref'd file are not accessible, confirming it produces a metadata (assembly) reference rather than a source-level reference. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Verify that app.cs -> lib1.cs -> lib2.cs transitive references work correctly, with each level building its dependencies recursively. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Verify that app.cs using both #:ref lib.cs and #:project ProjectLib works when both lib.cs and ProjectLib reference a common project. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add support for referencing one file-based app from another via the
#:ref directive. When a file uses #:ref lib.cs, the referenced file is
built as a library (OutputType=Library) using the existing virtual
project infrastructure, and the output DLL is referenced via a
item in the referencing app's virtual project.
Key changes:
Related to #52532.