Support dotnet pack file.cs#50168
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements support for dotnet pack file.cs to enable packing file-based programs directly from C# source files. The change allows users to create NuGet packages from standalone C# files without requiring a traditional project file structure.
Key changes:
- Modified the
PackCommandto detect and handle file-based programs using the virtual project building infrastructure - Updated command completion descriptions to include C# files as valid inputs
- Added test coverage for the new functionality
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/Cli/dotnet/Commands/Pack/PackCommand.cs | Refactored to use CommandFactory pattern and support file-based programs through VirtualProjectBuildingCommand |
| src/Cli/dotnet/Commands/Pack/PackCommandParser.cs | Updated argument name and description to include C# files as valid inputs |
| src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs | Added PackageOutputPath property and updated runtime config logic to exclude Pack target |
| test/dotnet.Tests/CommandTests/Run/RunFileTests.cs | Added comprehensive test for pack functionality and updated virtual project templates |
| test/dotnet.Tests/CommandTests/MSBuild/GivenDotnetPackInvocation.cs | Fixed cast to handle new return type from PackCommand.FromArgs |
| documentation/general/dotnet-run-file.md | Updated documentation to reflect pack support and clarify behavior |
| test/dotnet.Tests/CompletionTests/snapshots/zsh/DotnetCliSnapshotTests.VerifyCompletions.verified.zsh | Updated completion description to include C# files |
Comments suppressed due to low confidence (1)
|
Removing my assignment since I speculate Fred and Chris's sign off will be enough. Let me know if I misunderstood something. Thanks |
|
@333fred for another look, thanks |
This reverts commit 5b2680d.
|
Setting both Hence I've reverted the last commit and I plan to merge this without the |
Resolves #49369.