RicoSuter / NSwag

The Swagger/OpenAPI toolchain for .NET, ASP.NET Core and TypeScript.
http://NSwag.org
MIT License
6.69k stars 1.24k forks source link

Issue with NSwag Commands - Project outputs not located in specified directory V 14.0.1 #4707

Closed MehdiElMellali closed 8 months ago

MehdiElMellali commented 8 months ago

Description

I encountered an issue while using NSwag Commands, where it fails with the following error:

System.InvalidOperationException: Project outputs could not be located in 'C:\Repos\src\Api\bin\Debug\net8.0\Net80\'. Ensure that the project has been built.

Runtime: Net80
   at NSwag.Commands.Generation.AspNetCore.AspNetCoreToOpenApiCommand.RunAsync(CommandLineProcessor processor, IConsoleHost host) in /_/src/NSwag.Commands/Commands/Generation/AspNetCore/AspNetCoreToOpenApiCommand.cs:line 82
   at NSwag.Commands.NSwagDocumentBase.GenerateSwaggerDocumentAsync() in /_/src/NSwag.Commands/NSwagDocumentBase.cs:line 270
   at NSwag.Commands.NSwagDocument.ExecuteAsync() in /_/src/NSwag.Commands/NSwagDocument.cs:line 67
   at NSwag.Commands.Document.ExecuteDocumentCommand.ExecuteDocumentAsync(IConsoleHost host, String filePath) in /_/src/NSwag.Commands/Commands/Document/ExecuteDocumentCommand.cs:line 76
   at NSwag.Commands.Document.ExecuteDocumentCommand.RunAsync(CommandLineProcessor processor, IConsoleHost host) in /_/src/NSwag.Commands/Commands/Document/ExecuteDocumentCommand.cs:line 33
   at NConsole.CommandLineProcessor.ProcessSingleAsync(String[] args, Object input)
   at NConsole.CommandLineProcessor.ProcessAsync(String[] args, Object input)
   at NSwag.Commands.NSwagCommandProcessor.ProcessAsync(String[] args) in /_/src/NSwag.Commands/NSwagCommandProcessor.cs:line 62

Nswag.json code:

{
  "runtime": "Net80",
  "defaultVariables": "Configuration=Debug",
  "documentGenerator": {
    "aspNetCoreToOpenApi": {
      "project": "../Api.csproj",
      "documentName": "v1",
      "msBuildProjectExtensionsPath": null,
      "configuration": null,
      "runtime": "Net80",
      "targetFramework": null,
      "noBuild": true,
      "msBuildOutputPath": null,
      "verbose": true,
      "workingDirectory": null,
      "aspNetCoreEnvironment": null,
      "output": null,
      "newLineBehavior": "Auto"
    }
  },

Steps to Reproduce

Expected Behavior

NSwag Commands should run successfully without any issues.

Actual Behavior The tool is unable to locate project outputs in the specified directory, even though the project has been built.

Environment

Runtime: Net80 NSwag version : 14.0.1 Additional Information Include any additional information that might be helpful in understanding or reproducing the issue.

Thank you for looking into this matter. Let me know if you need any further details.