{"record":{"id":"9903471630440ddf","repo":"RicoSuter/NSwag","slug":"unable-to-locate-binaryname-in-tooldirectory","errorCode":null,"errorMessage":"Unable to locate {binaryName} in {toolDirectory}.","messagePattern":"Unable to locate (.+?) in (.+?)\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/NSwag.Commands/Commands/Generation/AspNetCore/AspNetCoreToOpenApiCommand.cs","lineNumber":121,"sourceCode":"                        throw new InvalidOperationException($\"The ouput of {projectFile} is a 32-bit application and requires NSwag.Console.x86 to be processed.\");\n                    }\n\n                    binaryName = LauncherBinaryName + \".x86.exe\";\n                }\n                else\n                {\n                    if (!Environment.Is64BitProcess)\n                    {\n                        throw new InvalidOperationException($\"The ouput of {projectFile} is a 64-bit application and requires NSwag.Console to be processed.\");\n                    }\n\n                    binaryName = LauncherBinaryName + \".exe\";\n                }\n\n                var executableSource = Path.Combine(toolDirectory, binaryName);\n                if (!File.Exists(executableSource))\n                {\n                    throw new InvalidOperationException($\"Unable to locate {binaryName} in {toolDirectory}.\");\n                }\n\n                executable = Path.Combine(projectMetadata.OutputPath, binaryName);\n                File.Copy(executableSource, executable, overwrite: true);\n                cleanupFiles.Add(executable);\n\n                var appConfig = Path.Combine(projectMetadata.OutputPath, projectMetadata.TargetFileName + \".config\");\n                if (File.Exists(appConfig))\n                {\n                    var copiedAppConfig = Path.ChangeExtension(executable, \".exe.config\");\n                    File.Copy(appConfig, copiedAppConfig, overwrite: true);\n                    cleanupFiles.Add(copiedAppConfig);\n                }\n            }\n#else\n            var toolDirectory = AppContext.BaseDirectory;\n            if (!Directory.Exists(toolDirectory))\n            {","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/RicoSuter/NSwag/blob/63daf8fcc3a25151b62eb4b326a1e8ea048a0d41/src/NSwag.Commands/Commands/Generation/AspNetCore/AspNetCoreToOpenApiCommand.cs#L103-L139","documentation":"After choosing the correct launcher binary (NSwag.AspNetCore.Launcher.exe or .x86.exe based on bitness), the .NET Framework path of RunAsync verifies the binary exists in the NSwag tool directory and copies it next to the project's output. If the launcher exe is missing from the installation, this error is thrown, meaning the NSwag installation is incomplete or corrupted.","triggerScenarios":"Running the NET462 NSwag tool where File.Exists(Path.Combine(toolDirectory, 'NSwag.AspNetCore.Launcher[.x86].exe')) is false — i.e. the launcher executable was not deployed alongside NSwag.Console.exe.","commonSituations":"Partial NuGet package copies; manually copying just NSwag.Console.exe without its launcher siblings; antivirus quarantining or deleting the launcher exe; thin publish/deployment of the tool directory that skipped payload binaries.","solutions":["Reinstall/repair NSwag (reinstall the NSwag.Console NuGet package, Chocolatey package, or download the full release zip) so all binaries ship together.","Verify NSwag.AspNetCore.Launcher.exe (and the .x86 variant) exist in the tool directory next to NSwag.Console.exe.","Check antivirus/EDR quarantine logs and whitelist the NSwag tool directory.","Copy the complete contents of a known-good NSwag installation directory rather than individual files."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"var launcher = Path.Combine(toolDir, \"NSwag.AspNetCore.Launcher.exe\");\nif (!File.Exists(launcher))\n    throw new InvalidOperationException($\"NSwag installation incomplete: {launcher} missing. Reinstall NSwag.\");","typeGuard":null,"tryCatchPattern":"try\n{\n    await command.RunAsync(processor, host);\n}\ncatch (InvalidOperationException ex) when (ex.Message.StartsWith(\"Unable to locate NSwag.AspNetCore.Launcher\"))\n{\n    // repair the NSwag installation before retrying\n}","preventionTips":["Deploy NSwag as a whole package/zip, never by copying individual exes.","Whitelist the NSwag tool directory in antivirus/EDR policies.","Verify installation contents after package upgrades in CI."],"tags":["installation","file-not-found","dotnet-framework"],"backgroundTag":"file-not-found","analyzedSha":"63daf8fcc3a25151b62eb4b326a1e8ea048a0d41","analyzedAt":"2026-09-14T11:38:15.205Z","contentChangedAt":"2026-09-14T11:38:15.205Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}