8000 Fix versioned sdk imports in file-based programs by jjonescz · Pull Request #49008 · dotnet/sdk · GitHub
[go: up one dir, main page]

Skip to content

Fix versioned sdk imports in file-based programs #49008

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jjonescz
Copy link
Member

Fixes #48990.

@jjonescz jjonescz requested a review from a team May 16, 2025 09:41
@jjonescz jjonescz added the Area-run-file Items related to the "dotnet run <file>" effort label May 16, 2025
@jjonescz jjonescz marked this pull request as ready for review May 16, 2025 14:43
@Copilot Copilot AI review requested due to automatic review settings May 16, 2025 14:43
Copy link
Contributor
@Copilot 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

This PR fixes the handling of versioned SDK imports by updating the import syntax both in test files and in the virtual project builder.

  • Added a new test ("SdkReference") to verify correct SDK import handling.
  • Updated XML import elements in test files and refactored XML generation in VirtualProjectBuildingCommand.cs to use a shared helper method.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
test/dotnet.Tests/CommandTests/Run/RunFileTests.cs Added a new test to ensure SDK references load correctly and updated XML import syntax.
src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs Refactored XML import creation with a new helper method to conditionally include the Version attribute.
Comments suppressed due to low confidence (1)

test/dotnet.Tests/CommandTests/Run/RunFileTests.cs:980

  • [nitpick] Verify that the indentation and newline handling in the triple-quoted string used for 'Program.cs' results in the exact XML formatting expected by the build command, as any extra whitespace might affect parsing.
File.WriteAllText(Path.Join(testInstance.Path, "Program.cs"), """

@jjonescz jjonescz requested review from a team, RikkiGibson, chsienki and MiYanni May 16, 2025 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-run-file Items related to the "dotnet run <file>" effort
Projects
None yet
Development

Successfully merging this pull request may close these issues.

file-based program can't find versioned package-based SDK reference
4 participants
0