{"record":{"id":"783624fa774d0e87","repo":"microsoft/aspire","slug":"embedded-runtime-identifier-graph-resource","errorCode":null,"errorMessage":"Embedded runtime identifier graph resource '{RuntimeIdentifierGraphResourceName}' was not found.","messagePattern":"Embedded runtime identifier graph resource '(.+?)' was not found\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Managed/NuGet/Commands/RestoreCommand.cs","lineNumber":341,"sourceCode":"\n        if (!string.IsNullOrWhiteSpace(runtimeIdentifier))\n        {\n            packageSpec.RuntimeGraph = new RuntimeGraph([new RuntimeDescription(runtimeIdentifier)]);\n        }\n\n        return packageSpec;\n    }\n\n    private static string EnsureRuntimeIdentifierGraphPath(string outputPath)\n    {\n        var graphPath = Path.Combine(outputPath, RuntimeIdentifierGraphFileName);\n        if (File.Exists(graphPath))\n        {\n            return graphPath;\n        }\n\n        using var resourceStream = typeof(RestoreCommand).Assembly.GetManifestResourceStream(RuntimeIdentifierGraphResourceName)\n            ?? throw new InvalidOperationException($\"Embedded runtime identifier graph resource '{RuntimeIdentifierGraphResourceName}' was not found.\");\n        using var fileStream = File.Create(graphPath);\n        resourceStream.CopyTo(fileStream);\n\n        return graphPath;\n    }\n}\n","sourceCodeStart":323,"sourceCodeEnd":348,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Managed/NuGet/Commands/RestoreCommand.cs#L323-L348","documentation":"RestoreCommand needs the NuGet runtime identifier graph (runtime.json) to expand RID compatibility during restore. Normally it writes an embedded copy of that graph to disk; if the embedded manifest resource is missing from the assembly it throws an InvalidOperationException instead of silently restoring without RID graph data.","triggerScenarios":"Calling runtimeIdentifierGraphPath when neither an on-disk graph file exists nor the assembly contains the embedded RuntimeIdentifierGraphResourceName resource — e.g. a broken or partially published build where embedded resources were stripped.","commonSituations":"Publishing with resource trimming/embedding disabled incorrectly, a packaging bug in a custom build, or the embedded resource name changed while a stale cached binary is still used.","solutions":["Rebuild/re-publish the application so the embedded runtime identifier graph resource is included in the assembly.","Verify the embedded resource name matches RuntimeIdentifierGraphResourceName (check the csproj EmbeddedResource entries).","If deploying, redeploy a complete build; do not strip embedded resources from the NuGet command assembly."],"exampleFix":"// before\n<ItemGroup>\n  <None Include=\"runtime.json\" CopyToOutputDirectory=\"PreserveNewest\" />\n</ItemGroup>\n// after\n<ItemGroup>\n  <EmbeddedResource Include=\"runtime.json\" LogicalName=\"runtime.json\" />\n</ItemGroup>","handlingStrategy":"try-catch","validationCode":"var hasGraph = typeof(RestoreCommand).Assembly.GetManifestResourceNames()\n    .Contains(RestoreCommand.RuntimeIdentifierGraphResourceName);","typeGuard":null,"tryCatchPattern":"try { var path = restoreCommand.RuntimeIdentifierGraphPath; }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"runtime identifier graph\"))\n{ logger.LogCritical(ex, \"Build is missing embedded RID graph; redeploy a complete build.\"); throw; }","preventionTips":["Verify EmbeddedResource entries for runtime.json in the project file","Smoke-test published/trimmed builds for required embedded resources","Avoid custom publish profiles that strip embedded resources"],"tags":["nuget","restore","embedded-resources"],"backgroundTag":"missing-dependency","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}