Skip to content

Commit 7aad51b

Browse files
committed
Switch to $(Start) to select startup file
Much shorter than the legacy ActiveCompile or the renamed ActiveFile. Just Start or even S works now.
1 parent 0dba1e8 commit 7aad51b

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

readme.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,11 @@ selecting the desired file from the Start button dropdown.
129129
When running from the command-line, you can select the file to run by passing it as an argument to `dotnet run`:
130130

131131
```bash
132-
dotnet run -p:ActiveFile program1.cs
132+
dotnet run -p:start=program1.cs
133133
```
134134

135+
You can also use the shortcut `-p:s=[FILE]`.
136+
135137
## How It Works
136138

137139
This nuget package leverages in concert the following standalone and otherwise

src/SmallSharp/SmallSharp.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<!-- Capture project-level properties before they are defaulted by Microsoft.Common.targets -->
88
<CustomBeforeMicrosoftCSharpTargets>$(MSBuildThisFileDirectory)\SmallSharp.Before.props</CustomBeforeMicrosoftCSharpTargets>
99

10-
<UsingSmallSharpSDK Condition="'$(UsingSmallSharpSDK)' == ''">false</UsingSmallSharpSDK>
10+
<UsingSmallSharpSDK Condition="'$(UsingSmallSharpSDK)' == ''">false</UsingSmallSharpSDK>
1111
</PropertyGroup>
1212

1313
<Import Project="SmallSharp.Version.props"/>

src/SmallSharp/SmallSharp.targets

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
<!-- Backs compat -->
1111
<ActiveFile Condition="'$(ActiveCompile)' != ''">$(ActiveCompile)</ActiveFile>
1212
<StartupFile>$(ActiveFile)</StartupFile>
13+
<StartupFile Condition="'$(StartupFile)' == ''">$(Start)</StartupFile>
14+
<StartupFile Condition="'$(StartupFile)' == ''">$(S)</StartupFile>
1315
<StartupFile Condition="'$(StartupFile)' == ''">$(ActiveDebugProfile)</StartupFile>
1416
<FindStartupFile Condition="'$(StartupFile)' == '' or !Exists('$(StartupFile)')">true</FindStartupFile>
1517
<StartupFileDependsOn>EnsureProperties;CollectStartupFile;SelectStartupFile;SelectTopLevelCompile;UpdateLaunchSettings;EmitTargets</StartupFileDependsOn>

src/demo.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jq --arg version "$version" '.["msbuild-sdks"].SmallSharp = $version' global.jso
77
# build with each top-level file as the active one
88
foreach ($file in gci *.cs) {
99
# rm -r -fo obj -ea 0
10-
dotnet build Demo.csproj -p:ActiveFile=$($file.Name) -bl:"$($file.BaseName).binlog"
10+
dotnet build Demo.csproj -p:start=$($file.Name) -bl:"$($file.BaseName).binlog"
1111
if ($LASTEXITCODE -ne 0) {
1212
Write-Error "Build failed for $($file.Name)"
1313
popd; popd;

0 commit comments

Comments
 (0)