From 304b99f13e3703c581fb55445ab766ec43b15a0b Mon Sep 17 00:00:00 2001 From: Daniel Cazzulino Date: Wed, 24 Sep 2025 16:57:37 -0300 Subject: [PATCH] Switch to $(Start) to select startup file Much shorter than the legacy ActiveCompile or the renamed ActiveFile. Just Start or even S works now. --- readme.md | 4 +++- src/SmallSharp/SmallSharp.props | 2 +- src/SmallSharp/SmallSharp.targets | 2 ++ src/demo.ps1 | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index 239ebf7..444ab3e 100644 --- a/readme.md +++ b/readme.md @@ -129,9 +129,11 @@ selecting the desired file from the Start button dropdown. When running from the command-line, you can select the file to run by passing it as an argument to `dotnet run`: ```bash -dotnet run -p:ActiveFile program1.cs +dotnet run -p:start=program1.cs ``` +You can also use the shortcut `-p:s=[FILE]`. + ## How It Works This nuget package leverages in concert the following standalone and otherwise diff --git a/src/SmallSharp/SmallSharp.props b/src/SmallSharp/SmallSharp.props index 927055f..7596d39 100644 --- a/src/SmallSharp/SmallSharp.props +++ b/src/SmallSharp/SmallSharp.props @@ -7,7 +7,7 @@ $(MSBuildThisFileDirectory)\SmallSharp.Before.props - false + false diff --git a/src/SmallSharp/SmallSharp.targets b/src/SmallSharp/SmallSharp.targets index 82f5cdf..f49a053 100644 --- a/src/SmallSharp/SmallSharp.targets +++ b/src/SmallSharp/SmallSharp.targets @@ -10,6 +10,8 @@ $(ActiveCompile) $(ActiveFile) + $(Start) + $(S) $(ActiveDebugProfile) true EnsureProperties;CollectStartupFile;SelectStartupFile;SelectTopLevelCompile;UpdateLaunchSettings;EmitTargets diff --git a/src/demo.ps1 b/src/demo.ps1 index 3063ce5..fcb1cf1 100644 --- a/src/demo.ps1 +++ b/src/demo.ps1 @@ -7,7 +7,7 @@ jq --arg version "$version" '.["msbuild-sdks"].SmallSharp = $version' global.jso # build with each top-level file as the active one foreach ($file in gci *.cs) { # rm -r -fo obj -ea 0 - dotnet build Demo.csproj -p:ActiveFile=$($file.Name) -bl:"$($file.BaseName).binlog" + dotnet build Demo.csproj -p:start=$($file.Name) -bl:"$($file.BaseName).binlog" if ($LASTEXITCODE -ne 0) { Write-Error "Build failed for $($file.Name)" popd; popd;