I was working with Visual Studio 2022 (Version 17.6.5). The project has consumed the nuget package for NSwag.ApiDescription.Client (version 13.19.0)
. It was working fine.
When I moved the project to another machine, it starts generating this error on Rebuild
:
The command ""C:\Users\x\source\repos\G21-V5-Web\packages_rep\nswag.msbuild\13.0.5\build\ ../tools/Win/NSwag.exe" openapi2csclient /className:ServiceClient /namespace:MyService /input:C:\Users\x\source\repos\G21-V5-Web\swagger.json /output:obj\swaggerClient.cs " exited with code -1.
I found out the root cause in my case was the whitespaces in the path to the project.
We need to fix in the file:
C:\Users\x\source\repos\G21-V5-Web\packages_rep\nswag.apidescription.client\13.0.5 \build\NSwag.ApiDescription.Client.targets
You will find line # 21 similar to this:
<Command>%(Command) /input:%(FullPath) /output:%(OutputPath) %(Options)</Command>
To make swagger work with whitespaces, change this line by adding double quotes around the path
:
<Command>%(Command) /input:"%(FullPath)" /output:"%(OutputPath)" %(Options)</Command>
My project works fine after this fix.
No comments:
Post a Comment