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
I tried upgrading NSwag.Commands from 14.0.7 to 14.0.8 for a project running .net6 which then failed with the following exception:
Could not load file or assembly 'System.Text.Encodings.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
and this stack trace.
at NJsonSchema.CodeGeneration.DefaultTemplateFactory.LiquidParser..ctor()
at NJsonSchema.CodeGeneration.DefaultTemplateFactory.LiquidTemplate..cctor()
Minimal reproducible example
using NSwag.Commands.CodeGeneration;varcommand=new OpenApiToCSharpClientCommand
{Input="https://petstore.swagger.io/v2/swagger.json",};await command.RunAsync();
This is also reproducible by changing the TFM of NSwag.CodeGeneration.Tests from net8 to net6.
I traced this via #4913 back to sebastienros/fluid#639 which upgrade Fluid.Core from System.Text.Json 5.0.2 to 8.0.3 for the netstandard2.0 targets.
So the previously referenced Fluid.Core@2.5.0 references System.Text.Json@5.0.2, whereas the now referenced Fluid.Core@2.9.0 references System.Text.Json@8.0.3.
When looking in the generated project.assets.json for the example project above, for to me unknown reasons, it looks like it references Fluid.Core@net6, so it somehow isn't instructed to bump System.Text.Json to 8.0.3
I guess this is the underlying reason why NSwag.Commands doesn't "just work" for .net6.0.
I tried upgrading NSwag.Commands from 14.0.7 to 14.0.8 for a project running .net6 which then failed with the following exception:
and this stack trace.
Minimal reproducible example
This is also reproducible by changing the TFM of
NSwag.CodeGeneration.Tests
from net8 to net6.I traced this via #4913 back to sebastienros/fluid#639 which upgrade Fluid.Core from System.Text.Json 5.0.2 to 8.0.3 for the netstandard2.0 targets.
So the previously referenced Fluid.Core@2.5.0 references System.Text.Json@5.0.2, whereas the now referenced Fluid.Core@2.9.0 references System.Text.Json@8.0.3.
When looking in the generated
project.assets.json
for the example project above, for to me unknown reasons, it looks like it references Fluid.Core@net6, so it somehow isn't instructed to bump System.Text.Json to 8.0.3I guess this is the underlying reason why NSwag.Commands doesn't "just work" for .net6.0.
Possible workarounds on my side:
<PackageReference Include="System.Text.Json" Version="8.0.3" />
Possible workaround in
NSwag.CodeGeneration.csproj
<PackageReference Include="System.Text.Json" Version="8.0.3" Condition="'$(TargetFramework)'=='netstandard2.0'" />
The text was updated successfully, but these errors were encountered: