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
We currently have a couple of issues (#636 , #602 and #588) which points back to the fact that it is currently not possible to specify the SDK being used by dotnet-script.
Today we have a csprojtemplate file that looks like this.
Say now that we wanted to spin up a minimal web api in a script.
This would require the project sdk to be set to <Project Sdk="Microsoft.NET.Sdk.Web">, but since that is basically "hardcoded" into the template we currently don't have a way for specifying the SDK.
For this to work not only during execution, but also from the OmniSharp side we would need something that can be read when resolving dependencies (runtime and compilation).
Since <Project Sdk="Microsoft.NET.Sdk"> basically is a way to specify which assemblies from the shared framework to be pulled in, it might make sense to extend upon the #r directive here.
Suggested syntax
#r "sdk:Microsoft.NET.Sdk.Web"
We will then use the given sdk when creating the csproj file used for restore and dependency resolving.
The default would be Microsoft.NET.Sdk as before unless specified in the #r directive
That makes sense to me, we would still default to Microsoft.NET.Sdk. The sdk prefix (vs the nuget) is a good idea, especially as in the csproj files, the SDKs, despite being nuget packages themselves, are also given a "special treatment".
I also think this should be quite easy to implement (unless I am being a short-sighted).
Is there any workaround I could use today that would allow dotnet-script to work with Microsoft.NET.Sdk.Web? Specifically, want dynamically generated scripts to start a small web server to host some short-lived API routes.
We currently have a couple of issues (#636 , #602 and #588) which points back to the fact that it is currently not possible to specify the SDK being used by
dotnet-script
.Today we have a
csproj
template file that looks like this.Say now that we wanted to spin up a minimal web api in a script.
This would require the project sdk to be set to
<Project Sdk="Microsoft.NET.Sdk.Web">
, but since that is basically "hardcoded" into the template we currently don't have a way for specifying the SDK.For this to work not only during execution, but also from the OmniSharp side we would need something that can be read when resolving dependencies (runtime and compilation).
Since
<Project Sdk="Microsoft.NET.Sdk">
basically is a way to specify which assemblies from the shared framework to be pulled in, it might make sense to extend upon the#r
directive here.Suggested syntax
We will then use the given sdk when creating the csproj file used for restore and dependency resolving.
The default would be
Microsoft.NET.Sdk
as before unless specified in the#r
directivecsproj file with
#r "sdk:Microsoft.NET.Sdk.Web"
@filipw Thoughts? 😃
The text was updated successfully, but these errors were encountered: