8000 Allow `build --no-restore` for file-based programs by jjonescz · Pull Request #49013 · dotnet/sdk · GitHub
[go: up one dir, main page]

Skip to content

Allow build --no-restore for file-based programs #49013

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

Previously NoCache + NoRestore was disallowed, but there is actually no reason to disallow that combination. Also dotnet build file.cs implicitly passes NoCache, hence dotnet build --no-restore file.cs didn't work.

@jjonescz jjonescz requested a review from a team May 16, 2025 13:29
@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 15:59
@Copilot Copilot AI review requested due to automatic review settings May 16, 2025 15:59
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 updates the handling of the "--no-restore" flag for file-based programs, allowing its use even when combined with NoCache. Key changes include:

  • Renaming an existing test method from NoRestore to NoRestore_01.
  • Adding a new test method NoRestore_02 that verifies behavior when no restore is performed before a build.
  • Removing an exception in VirtualProjectBuildingCommand that previously disallowed the NoCache and NoRestore combination.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
test/dotnet.Tests/CommandTests/Run/RunFileTests.cs Updates to test method naming and additional tests for "--no-restore" behavior
src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs Removal of validation that threw on the NoCache + NoRestore combination
Comments suppressed due to low confidence (2)

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

  • [nitpick] Consider using a more descriptive test method name instead of 'NoRestore_01' to clearly indicate the scenario being validated. For example, include details about the expected behavior when a build is performed with '--no-restore' without a prior restore.
public void NoRestore_01()

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

  • [nitpick] Consider using a more descriptive test method name instead of 'NoRestore_02' to convey the test scenario more clearly, such as emphasizing the sequential restore and build operations.
public void NoRestore_02()

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.

2 participants
0