{"record":{"id":"47270240805093aa","repo":"dotnet/reactive","slug":"no-nupkg-file-found-after-packing-the-project","errorCode":null,"errorMessage":"No .nupkg file found after packing the project","messagePattern":"No \\.nupkg file found after packing the project","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"Rx.NET/Test/Gauntlet/RxGauntlet.Common/Build/ComponentBuilder.cs","lineNumber":32,"sourceCode":"        Action<ProjectFileRewriter> modifyProjectFile,\n        (string FeedName, string FeedLocation)[]? additionalPackageSources)\n    {\n        (string projectTemplateFileName, ModifiedProjectClone projectClone) = CreateModifiedProjectClone(\n            PackageTempFolderName, templateCsProj, modifyProjectFile, additionalPackageSources);\n\n        BuildOutput packResults = await projectClone.RunDotnetPack(projectTemplateFileName);\n\n        if (!Directory.Exists(LocalNuGetPackageFolderPath))\n        {\n            Directory.CreateDirectory(LocalNuGetPackageFolderPath);\n        }\n\n        string nupkgPath = Directory.GetFiles(\n            packResults.OutputFolder,\n            \"*.nupkg\",\n            SearchOption.AllDirectories) switch\n        {\n            [] => throw new InvalidOperationException(\"No .nupkg file found after packing the project\"),\n            [string nupkgFile] => nupkgFile,\n            _ => throw new InvalidOperationException(\"Multiple .nupkg files found after packing the project\")\n        };\n\n        string destinationNupkgPath = Path.Combine(LocalNuGetPackageFolderPath, Path.GetFileName(nupkgPath));\n        File.Copy(nupkgPath, destinationNupkgPath);\n\n        return packResults;\n    }\n\n    /// <summary>\n    /// \n    /// </summary>\n    /// <param name=\"templateCsProj\"></param>\n    /// <param name=\"modifyProjectFile\"></param>\n    /// <param name=\"additionalPackageSources\"></param>\n    /// <returns>\n    /// A task that produces the path to the <c>bin\\Release</c> folder of the built application.","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/Rx.NET/Test/Gauntlet/RxGauntlet.Common/Build/ComponentBuilder.cs#L14-L50","documentation":"ComponentBuilder.BuildLocalNuGetPackageAsync runs dotnet pack and then searches the output folder recursively for *.nupkg files. The result is pattern-matched: an empty list throws InvalidOperationException('No .nupkg file found after packing the project'), meaning pack claimed success but produced no package file.","triggerScenarios":"Directory.GetFiles(packResults.OutputFolder, '*.nupkg', AllDirectories) returns zero entries even though the pack command exited successfully.","commonSituations":"dotnet pack ran with wrong output path so the nupkg landed outside OutputFolder; pack skipped packaging (no Packable targets); a stale output-folder expectation after SDK changes; output cleaned between pack and search.","solutions":["Check the pack output log for where the nupkg was actually written and fix OutputFolder assumptions","Run dotnet pack manually and confirm a .nupkg is produced in the expected folder","Verify the project is packable (has package metadata / IsPackable=true)","Clear bin/obj and re-run to rule out stale or cleaned output"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (pack.ExitCode != 0) throw new InvalidOperationException(\"dotnet pack failed\");\nif (!Directory.EnumerateFiles(outDir, \"*.nupkg\", SearchOption.AllDirectories).Any())\n    throw new InvalidOperationException(\"Pack produced no nupkg; check -o path\");","typeGuard":null,"tryCatchPattern":"try\n{\n    var results = await builder.BuildLocalNuGetPackageAsync(...);\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"No .nupkg file found\"))\n{\n    // inspect pack log/output folder, fix output path, retry\n}","preventionTips":["Pass an explicit -o output folder to dotnet pack and use that same folder for searching","Ensure the project is packable (IsPackable, package metadata present)","Clean bin/obj if pack output is unexpectedly missing","Log the full pack stdout so the real nupkg location is visible"],"tags":["nuget","pack","file-not-found","build"],"backgroundTag":"empty-result-set","analyzedSha":"94b5d5ab912789f5abe9a72138a25bbd716fe59c","analyzedAt":"2026-09-15T02:26:24.759Z","contentChangedAt":"2026-09-15T02:26:24.759Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}