From 864e344324721cfa968d3c94dcb05e84b5b9eb93 Mon Sep 17 00:00:00 2001 From: Jan Jones Date: Fri, 18 Jul 2025 14:06:24 +0200 Subject: [PATCH] Add property FileBasedProgram --- documentation/general/dotnet-run-file.md | 2 ++ src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs | 1 + test/dotnet.Tests/CommandTests/Run/RunFileTests.cs | 3 +++ 3 files changed, 6 insertions(+) diff --git a/documentation/general/dotnet-run-file.md b/documentation/general/dotnet-run-file.md index 0c75aa0910d7..2a06c445a566 100644 --- a/documentation/general/dotnet-run-file.md +++ b/documentation/general/dotnet-run-file.md @@ -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, diff --git a/src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs b/src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs index eeaa182c24eb..806b0b8040bb 100644 --- a/src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs +++ b/src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs @@ -653,6 +653,7 @@ public static void WriteProjectFile( false {EscapeValue(artifactsPath)} artifacts/$(MSBuildProjectName) + true diff --git a/test/dotnet.Tests/CommandTests/Run/RunFileTests.cs b/test/dotnet.Tests/CommandTests/Run/RunFileTests.cs index 98b62c75dd06..9ec23b62e1cb 100644 --- a/test/dotnet.Tests/CommandTests/Run/RunFileTests.cs +++ b/test/dotnet.Tests/CommandTests/Run/RunFileTests.cs @@ -1846,6 +1846,7 @@ public void Api() false /artifacts artifacts/$(MSBuildProjectName) + true @@ -1925,6 +1926,7 @@ public void Api_Diagnostic_01() false /artifacts artifacts/$(MSBuildProjectName) + true @@ -1997,6 +1999,7 @@ public void Api_Diagnostic_02() false /artifacts artifacts/$(MSBuildProjectName) + true