{"record":{"id":"7e0f1d4563d54a31","repo":"RicoSuter/NSwag","slug":"the-ouput-of-projectfile-is-a-32-bit-application-and","errorCode":null,"errorMessage":"The ouput of {projectFile} is a 32-bit application and requires NSwag.Console.x86 to be processed.","messagePattern":"The ouput of (.+?) is a 32-bit application and requires NSwag\\.Console\\.x86 to be processed\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/NSwag.Commands/Commands/Generation/AspNetCore/AspNetCoreToOpenApiCommand.cs","lineNumber":103,"sourceCode":"            var args = new List<string>();\n            string executable;\n\n#if NET462\n            var toolDirectory = AppDomain.CurrentDomain.BaseDirectory;\n            if (!Directory.Exists(toolDirectory))\n            {\n                toolDirectory = Path.GetDirectoryName(typeof(AspNetCoreToOpenApiCommand).GetTypeInfo().Assembly.Location);\n            }\n\n            if (projectMetadata.TargetFrameworkIdentifier == \".NETFramework\")\n            {\n                string binaryName;\n                var is32BitProject = string.Equals(projectMetadata.PlatformTarget, \"x86\", StringComparison.OrdinalIgnoreCase);\n                if (is32BitProject)\n                {\n                    if (Environment.Is64BitProcess)\n                    {\n                        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}.\");","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/RicoSuter/NSwag/blob/63daf8fcc3a25151b62eb4b326a1e8ea048a0d41/src/NSwag.Commands/Commands/Generation/AspNetCore/AspNetCoreToOpenApiCommand.cs#L85-L121","documentation":"When the target project is a .NET Framework project with PlatformTarget x86, the .NET Framework (NET462) build of NSwag must run as a 32-bit process to load the assembly. If the running NSwag process is 64-bit, RunAsync throws this error and tells the user to use the NSwag.Console.x86 tool instead, which is shipped as a separate 32-bit binary.","triggerScenarios":"Running the 64-bit NSwag.Console (or NSwag.MSBuild default) against a .csproj whose MSBuild PlatformTarget is 'x86', under the NET462 branch of AspNetCoreToOpenApiCommand.RunAsync while Environment.Is64BitProcess is true.","commonSituations":"A project was switched from AnyCPU to x86 (often to match native dependencies); using nswag.msbuild or the 64-bit Chocolatey/nuget console exe on such a project; 64-bit CI agents launching NSwag for 32-bit legacy Web API projects.","solutions":["Run NSwag.Console.x86.exe instead of NSwag.Console.exe for this project.","Change the project's PlatformTarget back to AnyCPU in the .csproj if 32-bit is not actually required.","If using NSwag.MSBuild, configure the task to invoke the x86 variant of the tool."],"exampleFix":"// before (64-bit tool)\nnswag aspnetcore2openapi /project:LegacyApi.csproj\n// after (x86 tool)\n\"C:\\tools\\nswag\\NSwag.Console.x86.exe\" aspnetcore2openapi /project:LegacyApi.csproj","handlingStrategy":"validation","validationCode":"var isX86 = string.Equals(platformTarget, \"x86\", StringComparison.OrdinalIgnoreCase);\nif (isX86 && Environment.Is64BitProcess)\n    Console.WriteLine(\"Project is x86: use NSwag.Console.x86.exe instead.\");","typeGuard":null,"tryCatchPattern":"try\n{\n    await command.RunAsync(processor, host);\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"NSwag.Console.x86\"))\n{\n    // re-exec via the x86 tool binary\n}","preventionTips":["Pick the NSwag console flavor (x86 vs x64) based on the project's PlatformTarget in your build scripts.","Pin PlatformTarget to AnyCPU when 32-bit is not required.","On 64-bit CI agents, explicitly invoke the x86 tool for x86 legacy projects."],"tags":["bitness","x86","dotnet-framework","cli"],"backgroundTag":"unsupported-platform","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"}