Home

Unable to update an old script with NJsonSchema4 to a newer version

edited September 2021

Hello,
Could you please help me with updating an old script (2018) with the new classes available now, because the old script can't be run anymore in LinqPad.

I want to run the the existing script on a yaml file with dotnet 3.1.

It complains about the SwaggerDocument, SwaggerToCSharpClientGeneratorSettings, SwaggerToCSharpClientGenerator and JsonProperty: The type or namespace name 'JsonProperty' could not be found.

I have used the following imports, but no success:
<NuGetReference>NSwag.CodeGeneration.CSharp</NuGetReference> <NuGetReference>YamlDotNet</NuGetReference> <NuGetReference>NSwag.Core</NuGetReference> <NuGetReference>NSwag.CodeGeneration</NuGetReference> <NuGetReference>NJsonSchema</NuGetReference> <NuGetReference>System.Globalization</NuGetReference> <NuGetReference>System.Text.RegularExpressions</NuGetReference> <NuGetReference>NJsonSchema.CodeGeneration</NuGetReference> <NuGetReference>NJsonSchema.CodeGeneration.CSharp</NuGetReference> <Namespace>NSwag</Namespace> <Namespace>NSwag.CodeGeneration</Namespace> <Namespace>NSwag.CodeGeneration.CSharp</Namespace> <Namespace>System.Globalization</Namespace> <Namespace>YamlDotNet.Serialization</Namespace> <Namespace>NJsonSchema</Namespace> <Namespace>System.Text.RegularExpressions</Namespace> <Namespace>NJsonSchema.CodeGeneration</Namespace> <Namespace>NJsonSchema.CodeGeneration.CSharp</Namespace>

Thank you for your help!

Comments

  • When you add a NuGet reference in LINQPad, you can click the down-arrow on the right-hand side of the button and choose a specific version to download. If you download a version that was released in 2018, your script might work as-is.

Sign In or Register to comment.