C
Join ServerC#
help
Swagger Doc failed
EElectron12/25/2022
What's wrong with it?
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="dotnet tool restore"/>
<Exec Command="dotnet swagger tofile --output $(SolutionDir)api.json $(OutputPath)$(AssemblyName).dll v1"/>
</Target>

EElectron12/25/2022

Pphaseshift12/25/2022
You have a space in one of your paths?
EElectron12/25/2022
dotnet swagger tofile --output C:\Users\user\Desktop\RF-V48_4G GPS_tracking_bracelet\navtrack-main\api.json bin\Debug\net6.0\Navtrack.Api.dll v1
EElectron12/25/2022
ugh
EElectron12/25/2022
I replaced these spaces with underscores but I accidentally left one
EElectron12/25/2022
thanks!
EElectron12/25/2022
@phaseshift is there a way to escape the spaces tho? Perhaps single quotes?
Pphaseshift12/25/2022
Depends what shell the command is running in.
Pphaseshift12/25/2022
Wrap in double quotes is normally ok
EElectron12/25/2022

EElectron12/25/2022
@phaseshift single quotes don't work, just confirmed
EElectron12/25/2022
so does double quotes cuz of the enclosing quotes
Pphaseshift12/25/2022
Yeah, so escape them
EElectron12/25/2022

Pphaseshift12/25/2022
Nope. Google it
EElectron12/25/2022

EElectron12/25/2022
that works but kinda looks ugly
Pphaseshift12/25/2022
Don't use spaces 🤷♂️
EElectron12/25/2022
I feel DevOps when they have to deal with such issues daily
Pphaseshift12/25/2022
Nobody in dev ops puts spaces in paths 😅
EElectron12/25/2022
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="dotnet tool restore"/>
<Exec Command="dotnet swagger tofile --output %22$(SolutionDir)api.json%22 %22$(OutputPath)$(AssemblyName).dll%22 v1"/>
</Target>
EElectron12/25/2022
I will keep it that way since Microsoft recommends it
EElectron12/25/2022
thanks and merry xmas! 😛
AAntonC12/25/2022
don't use msbuild for targets, use Nuke
AAntonC12/25/2022
just don't, you're wasting your time
EElectron12/25/2022
@AntonC agreed, I actually use Nuke myself but that's a project I wanted to run