Skip to content

Remove feature flag for transitive #: directives#54012

Merged
jjonescz merged 2 commits into
dotnet:release/10.0.4xxfrom
jjonescz:sprint-transitive-not-experimental
Apr 22, 2026
Merged

Remove feature flag for transitive #: directives#54012
jjonescz merged 2 commits into
dotnet:release/10.0.4xxfrom
jjonescz:sprint-transitive-not-experimental

Conversation

@jjonescz

Copy link
Copy Markdown
Member

Follow up on #53775 (comment).

Copilot AI review requested due to automatic review settings April 21, 2026 12:08
@jjonescz jjonescz added the Area-run-file Items related to the "dotnet run <file>" effort label Apr 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Removes the feature-flag gating for processing transitive file-level #: directives in file-based programs, aligning implementation, tests, and docs with the new default behavior.

Changes:

  • Stop checking ExperimentalFileBasedProgramEnableTransitiveDirectives when validating directives (transitive directives always allowed).
  • Update dotnet run file tests to no longer set the transitive-directives flag and remove the flag-specific test.
  • Remove the flag constant from the FileBasedPrograms internal API surface and update documentation accordingly.

Reviewed changes

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

Show a summary per file
File Description
test/dotnet.Tests/CommandTests/Run/RunFileTests.cs Removes transitive-directive flag setup and deletes the test that asserted the flag gating behavior.
src/Microsoft.DotNet.ProjectTools/VirtualProjectBuilder.cs Removes the runtime check that required the transitive-directives flag for non-entry-point directives.
src/Cli/Microsoft.DotNet.FileBasedPrograms/InternalAPI.Unshipped.txt Drops the internal API entry for the removed flag constant.
src/Cli/Microsoft.DotNet.FileBasedPrograms/FileLevelDirectiveHelpers.cs Removes the transitive-directives flag constant from CSharpDirective.IncludeOrExclude.
documentation/general/dotnet-run-file.md Removes documentation that stated transitive directives were gated behind a feature flag.

@jjonescz jjonescz requested a review from a team April 21, 2026 12:29
@DamianEdwards

Copy link
Copy Markdown
Member

Are we going to get this into 10.0.300 as well?

@jjonescz

jjonescz commented Apr 21, 2026

Copy link
Copy Markdown
Member Author

IIRC, code complete of 10.0.3xx was yesterday. Also the IDE integration is probably not even released yet.

@DamianEdwards

Copy link
Copy Markdown
Member

We should check on the code complete status and if there's a process for getting changes in still. On the IDE side they release far more often and the experience in the insiders and pre-release versions is already good and we can do follow ups to tweak the experience as needed. Is the opt-in flag for transitive directives removed for .NET 11 already?

@jjonescz

Copy link
Copy Markdown
Member Author

Is the opt-in flag for transitive directives removed for .NET 11 already?

No, but this PR will flow there once merged.

@jjonescz

Copy link
Copy Markdown
Member Author

/backport to release/10.0.3xx

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/10.0.3xx (link to workflow run)

@jjonescz jjonescz merged commit 1ae871d into dotnet:release/10.0.4xx Apr 22, 2026
28 checks passed
@jjonescz jjonescz deleted the sprint-transitive-not-experimental branch April 22, 2026 07:52
rkttu added a commit to rkttu/cadenza that referenced this pull request May 28, 2026
Two scripting ergonomics improvements that show up across every
Cadenza SDK variant.

`Env.ScriptPath` / `Env.ScriptDirectory` (src/core/Env.cs)
  Read the entry .cs file's absolute path from inside the running
  program. Backed by `AppContext.GetData("EntryPointFilePath")` /
  `EntryPointFileDirectoryPath`, which the .NET 10 file-based CLI
  injects as `RuntimeHostConfigurationOption` items on every
  `dotnet run`/`dotnet build`. Both return null after
  `dotnet publish` (the CLI strips those entries when the binary
  is no longer the script) — documented in the doc comments and
  the skill's gotcha list.

`ExperimentalFileBasedProgramEnableTransitiveDirectives=true`
  Defaulted in all five Sdk.props (Cadenza, Cadenza.Worker,
  Cadenza.Web, Cadenza.Mcp, Cadenza.Agent). Without this, a
  `#:package` / `#:property` / nested `#:include` inside an
  `#:include`d helper file is silently dropped by the directive
  preprocessor — verified empirically before shipping by
  reproducing the failure with a vanilla SDK and the success once
  the property lands in Sdk.props. The flag is read AFTER our
  Sdk.props is imported into the synthesized csproj, so it works
  from there despite the directive parsing happening pre-MSBuild.
  Slated for removal once PR dotnet/sdk#54012 (transitive
  directives always-on) reaches the released SDK.

Family bump 1.0.14 -> 1.0.15.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

5 participants