You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for #:sdk directive and no restore failures
The SDK mode allows us to support the #:sdk directive such that our SDK imports the generated .sdk.props and .sdk.targets files. It can also set the required `ImportProjectExtension*` properties for automatically importing the targets during restore (if present in the base intermediate output path).
Even with the added properties, the situation on initial clone/run of a project using SmallSharp was suboptimal:
- whether in SDK mode or package mode, we'd need a second restore after the initial one and first EmitTargets run. VS does this automatically since it would detect the addition of new extension targets (due to the ImportProjectExtension* props) and restore again as needed. But it wouldn't work from the CLI
- this meant a dotnet build would fail consistently
So we have a dual mechanism that makes this seamless:
- In SDK mode we can optimize things by just parsing the startup/active file and injecting the package references before the restore graph is generated
- In package mode, we re-run restore and temporarily redirect the assets file to a different dynamic one to refresh the resolved assets.
Fixes#143
allow a very intuitive, simple and streamlined experience for quickly spiking or learning C#.
31
-
The addition of [dotnet run app.cs](https://devblogs.microsoft.com/dotnet/announcing-dotnet-run-app/) in
32
-
.NET 10 takes this further by allowing package references and even MSBuild properties to be
31
+
The addition of [file-based apps](https://devblogs.microsoft.com/dotnet/announcing-dotnet-run-app/) in
32
+
.NET 10 [takes this further](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/preprocessor-directives#file-based-apps) by allowing package references and even MSBuild properties to be
If your file-based apps use the `#:sdk`[directive](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/preprocessor-directives#file-based-apps),
97
+
you need to add SmallSharp as an SDK reference instead so the SDK is picked up by the
98
+
generated targets/props instead of the project file. You also don't need the additional
99
+
properties since the SDK mode sets them automatically for you:
0 commit comments