Skip to content

Add EntryPointFilePath MSBuild property#53603

Draft
jjonescz wants to merge 2 commits intodotnet:release/10.0.3xxfrom
jjonescz:sprint-shebang-warn
Draft

Add EntryPointFilePath MSBuild property#53603
jjonescz wants to merge 2 commits intodotnet:release/10.0.3xxfrom
jjonescz:sprint-shebang-warn

Conversation

@jjonescz
Copy link
Copy Markdown
Member

Needed for dotnet/roslyn#82944.

@jjonescz jjonescz added the Area-run-file Items related to the "dotnet run <file>" effort label Mar 26, 2026
@jjonescz jjonescz marked this pull request as ready for review March 26, 2026 16:38
@jjonescz jjonescz requested review from a team and Copilot March 26, 2026 16:38
Copy link
Copy Markdown
Contributor

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

Adds a new EntryPointFilePath MSBuild property for file-based programs (e.g., dotnet run Program.cs) and makes it available to Roslyn analyzers, addressing the need described in dotnet/roslyn#82944.

Changes:

  • Emit <EntryPointFilePath> into the generated virtual project for file-based programs.
  • Mark EntryPointFilePath as a CompilerVisibleProperty so it flows into analyzer config options during MSBuild builds.
  • Include build_property.EntryPointFilePath in the generated editorconfig used by the csc-only file-based compilation path, and update tests accordingly.

Reviewed changes

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

File Description
test/dotnet.Tests/CommandTests/Run/RunFileTests.cs Updates expected virtual project XML to include <EntryPointFilePath> for run-api tests.
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.Analyzers.targets Exposes EntryPointFilePath to the compiler/analyzers via CompilerVisibleProperty.
src/Microsoft.DotNet.ProjectTools/VirtualProjectBuilder.cs Writes <EntryPointFilePath> into the virtual project’s initial PropertyGroup.
src/Cli/dotnet/Commands/Run/CSharpCompilerCommand.Generated.cs Adds build_property.EntryPointFilePath to the generated editorconfig for the csc-only path.

@jjonescz jjonescz marked this pull request as draft March 27, 2026 11:28
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