0

I'm having the same issue reported here: https://github.com/dotnet/runtime/issues/61602#issuecomment-971824612

basically: trying to use System.Text.Json 6 in a dotnetapp3.1 application (which cannot be upgraded at the moment). This causes that the source generators to break the build.

One workaround suggested was to pass DisableSystemTextJsonSourceGenerator=true to the dotnet build command.

I tried that in the command line as -p:DisableSystemTextJsonSourceGenerator=true but the build still fails. It's also mentioned is possible to pass it throuh the directory.builds.props but I don't know how to do that.

How do you pass that parameter in that file?

dmorganb
  • 1,408
  • 16
  • 26

1 Answers1

0

I don't know the property in question and the use-case, but syntax-wise, your Directory.Build.props should contain the following:

<Project>
  <PropertyGroup>
    <DisableSystemTextJsonSourceGenerator>true</DisableSystemTextJsonSourceGenerator>
  </PropertyGroup>
</Project>

Since it does not work as a CLI parameter, I would be surprised if the Directory.Build.props worked. They both do the same thing.

svenhuebner
  • 342
  • 1
  • 2
  • 10