When I adding an rest api client in C# windows form project and .Net 4.8 , recieve following error:
Checking project for required NuGet packges… Downloading service reference from https://tp.tax.gov.ir
/req/… Adding service reference 2 to the project… Generating code to 2.cs… ErrorFailed adding service reference(s). Code generation for file NSwag.exe failed. Command line: openapi2csclient /input:“F:\Tara-2017\TARA\Foundation\OpenAPIs\2.json” /namespace:Net.TARA.Foundation /output:“F:\Tara-2017\TARA\Foundation\OpenAPIs\2.cs” Output: NSwag command line tool for .NET 4.6.1+ WinX64, toolchain v13.8.2.0 (NJsonSchema v10.2.1.0 (Newtonsoft.Json v11.0.0.0)) Visit http://NSwag.org
for more information. NSwag bin directory: C:\Users\TARA3\AppData\Local\Microsoft\VisualStudio\17.0_903d411a\WebTools\Downloads\NSwag.MSBuild\13.8.2\tools\Win Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path ‘’, line 0, position 0. at Newtonsoft.Json.JsonTextReader.ParseValue() at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) at NJsonSchema.Infrastructure.JsonSchemaSerialization.FromJson[T](String json, IContractResolver contractResolver) at NJsonSchema.Infrastructure.JsonSchemaSerialization.d__13`1.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NSwag.OpenApiDocument.d__57.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NSwag.OpenApiDocument.d__58.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NSwag.Commands.OutputCommandBase.d__9.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NSwag.Commands.InputOutputCommandBase.d__12.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NSwag.Commands.CodeGeneration.SwaggerToCSharpClientCommand.<b__92_0>d.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NSwag.Commands.CodeGeneration.SwaggerToCSharpClientCommand.d__92.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NSwag.Commands.CodeGeneration.SwaggerToCSharpClientCommand.d__91.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NConsole.CommandLineProcessor.d__12.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at NConsole.CommandLineProcessor.d__11.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NConsole.CommandLineProcessor.Process(String args, Object input) at NSwag.Commands.NSwagCommandProcessor.Process(String args)