dotnet/msbuild

Add System.Text.Json and System.Memory as builtin implicit references

Open

#9367 aperta il 28 ott 2023

Vedi su GitHub
 (6 commenti) (2 reazioni) (0 assegnatari)C# (1364 fork)batch import
Area: Taskshelp wantedtriaged

Metriche repository

Star
 (5062 star)
Metriche merge PR
 (Merge medio 6g 6h) (144 PR mergiate in 30 g)

Descrizione

To use (even a simplest) JSON serialization in inline tasks (UsingTask), today we are expected to specify two additional references:

  <UsingTask
    TaskName="JsonShenanigans"
    TaskFactory="RoslynCodeTaskFactory"
    AssemblyName="Microsoft.Build.Tasks.Core">
    <Task>
      <Reference Include="System.Text.Json"/>
      <Reference Include="System.Memory"/>
      <Using ...

It would be nice to not require specifying these two references by promoting S.T.J assembly as a first-class citizen of RoslynCodeTaskFactory-based UsingTask.

ps - perhaps the entire set of current Microsoft.NETCore.App / Shared Framework references can be available implicitly in this scope if it does not violate any design principle? Requiring user to only specify <Using Namespace=".." /> to use anything out of SFX.

Guida contributor