I used Visual Studio Add-Service-Reference to add a service that uses the OpenAPI Specification.
I input the swagger URL and generated the code.
The .csproj indicates that the service is configured.
However when I try to build I get an error.
The wizard contained this link
The service was generated using AutoRest. I am using VS2022 17.2.5
The full error is
Error MSB3073 The command ""C:\Users\kirst.nuget\packages\nswag.msbuild\13.0.5\build../tools/Win/NSwag.exe" openapi2csclient /className:myapicls /namespace:myapi /input:D:\dev\MyApi\UnitTestProject1\OpenAPIs\index.html /output:obj\indexClient.cs " exited with code -1. UnitTestProject1 C:\Users\kirst.nuget\packages\nswag.apidescription.client\13.0.5\build\NSwag.ApiDescription.Client.targets 28
A service reference expects an OpenAPI YAML/JSON document, not the Swagger UI web page. This answer explains how you can find the URL of your OpenAPI YAML/JSON file or export it from Swagger UI.