Skip to content

Add property FileBasedProgram #49861

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

Merged
merged 1 commit into from
Jul 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions documentation/general/dotnet-run-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ Additionally, the implicit project file has the following customizations:
string? directoryPath = AppContext.GetData("EntryPointFileDirectoryPath") as string;
```

- `FileBasedProgram` property is set to `true` and can be used by SDK targets to detect file-based apps.

## Grow up

When file-based programs reach an inflection point where build customizations in a project file are needed,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,7 @@ public static void WriteProjectFile(
<IncludeProjectNameInArtifactsPaths>false</IncludeProjectNameInArtifactsPaths>
<ArtifactsPath>{EscapeValue(artifactsPath)}</ArtifactsPath>
<PublishDir>artifacts/$(MSBuildProjectName)</PublishDir>
<FileBasedProgram>true</FileBasedProgram>
</PropertyGroup>

<ItemGroup>
Expand Down
3 changes: 3 additions & 0 deletions test/dotnet.Tests/CommandTests/Run/RunFileTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1846,6 +1846,7 @@ public void Api()
<IncludeProjectNameInArtifactsPaths>false</IncludeProjectNameInArtifactsPaths>
<ArtifactsPath>/artifacts</ArtifactsPath>
<PublishDir>artifacts/$(MSBuildProjectName)</PublishDir>
<FileBasedProgram>true</FileBasedProgram>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -1925,6 +1926,7 @@ public void Api_Diagnostic_01()
<IncludeProjectNameInArtifactsPaths>false</IncludeProjectNameInArtifactsPaths>
<ArtifactsPath>/artifacts</ArtifactsPath>
<PublishDir>artifacts/$(MSBuildProjectName)</PublishDir>
<FileBasedProgram>true</FileBasedProgram>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -1997,6 +1999,7 @@ public void Api_Diagnostic_02()
<IncludeProjectNameInArtifactsPaths>false</IncludeProjectNameInArtifactsPaths>
<ArtifactsPath>/artifacts</ArtifactsPath>
<PublishDir>artifacts/$(MSBuildProjectName)</PublishDir>
<FileBasedProgram>true</FileBasedProgram>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading