@@ -72,9 +72,29 @@ files in subdirectories and those will behave like normal compile items.
7272
7373## Usage
7474
75- SmallSharp works by just installing the
76- [ SmallSharp] ( https://nuget.org/packages/SmallSharp ) nuget package in a C# console project
77- and adding a couple extra properties to the project file:
75+ The recommended way to use SmallSharp is via the SDK mode, which provides the most streamlined
76+ and seamless experience across IDE and CLI builds:
77+
78+ ``` xml
79+ <Project Sdk =" SmallSharp/2.2.3" >
80+
81+ <PropertyGroup >
82+ <OutputType >Exe</OutputType >
83+ <!-- 👇 allows c# file to override the TF via a #:property -->
84+ <TargetFramework Condition =" $(TargetFramework) == ''" >net10.0</TargetFramework >
85+ </PropertyGroup >
86+
87+ </Project >
88+ ```
89+
90+ The SDK mode will always produce a successful build in a single ` dotnet build ` pass even if you
91+ change the ` ActiveFile ` between builds.
92+
93+ > [ !IMPORTANT]
94+ > If no ` #:sdk ` directive is provided by a specific C# file-based app, the ` Microsoft.NET.SDK ` will be
95+ > used by default in this SDK mode.
96+
97+ If you prefer, you can also use SmallSharp as a regular package reference in a C# console project:
7898
7999``` xml
80100<Project Sdk =" Microsoft.NET.Sdk" >
@@ -96,36 +116,14 @@ and adding a couple extra properties to the project file:
96116</Project >
97117```
98118
99- There are some limitations with this mode, however:
119+ This package-reference mode works, but it has some caveats and limitations:
100120* You cannot use the ` #:sdk ` [ directive] ( https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/preprocessor-directives#file-based-apps )
101121 to specify a different SDK per file, since the project file already specifies one.
102122* CLI-based builds may require multiple passes to restore and build the selected file, since
103123 the package is only restored after the first build.
104124* You must add ImportProjectExtensionProps/ImportProjectExtensionTargets manually, polluting the
105125 project file.
106126
107- So the recommended way to use SmallSharp is via the SDK mode, which results in a more streamlined
108- and seamless experience across IDE and CLI builds:
109-
110- ``` xml
111- <Project Sdk =" SmallSharp/2.2.3" >
112-
113- <PropertyGroup >
114- <OutputType >Exe</OutputType >
115- <!-- 👇 allows c# file to override the TF via a #:property -->
116- <TargetFramework Condition =" $(TargetFramework) == ''" >net10.0</TargetFramework >
117- </PropertyGroup >
118-
119- </Project >
120- ```
121-
122- The SDK mode will always produce a successful build in a single ` dotnet build ` pass even if you
123- change the ` ActiveFile ` between builds.
124-
125- > [ !IMPORTANT]
126- > If no ` #:sdk ` directive is provided by a specific C# file-based app, the ` Microsoft.NET.SDK ` will be
127- > used by default in this SDK mode.
128-
129127Keep adding as many top-level programs as you need, and switch between them easily by simply
130128selecting the desired file from the Start button dropdown.
131129
0 commit comments