{"record":{"id":"99f098acf41f4d14","repo":"microsoft/aspire","slug":"aspire-managed-not-found-in-layout-prebuiltapphostserver","errorCode":null,"errorMessage":"aspire-managed not found in layout.","messagePattern":"aspire-managed not found in layout\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"critical","filePath":"src/Aspire.Cli/Projects/PrebuiltAppHostServer.cs","lineNumber":137,"sourceCode":"\n    /// <inheritdoc />\n    public string AppDirectoryPath => _appDirectoryPath;\n\n    internal string? SelectedProjectLayoutFingerprint => _selectedProjectLayout?.Fingerprint;\n\n    internal string? SelectedProjectLayoutPath => _selectedProjectLayout?.LayoutPath;\n\n    internal string? IntegrationProbeManifestPath => _integrationProbeManifestPath;\n\n    /// <summary>\n    /// Gets the path to the aspire-managed executable (used as the server).\n    /// </summary>\n    public string GetServerPath()\n    {\n        var managedPath = _layout.GetManagedPath();\n        if (managedPath is null || !File.Exists(managedPath))\n        {\n            throw new InvalidOperationException(\"aspire-managed not found in layout.\");\n        }\n\n        return managedPath;\n    }\n\n    /// <inheritdoc />\n    public async Task<AppHostServerPrepareResult> PrepareAsync(\n        string sdkVersion,\n        IEnumerable<IntegrationReference> integrations,\n        string? requestedChannel = null,\n        string? packageSourceOverride = null,\n        CancellationToken cancellationToken = default)\n    {\n        var integrationList = integrations.ToList();\n        var packageRefs = integrationList.Where(r => r.IsPackageReference).ToList();\n        var projectRefs = integrationList.Where(r => r.IsProjectReference).ToList();\n        // Lifted to outer scope so the failure footer reflects the source actually used by\n        // restore — including the auto-discovered local hive resolved by","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Cli/Projects/PrebuiltAppHostServer.cs#L119-L155","documentation":"PrebuiltAppHostServer.GetServerPath resolves the aspire-managed server binary from the CLI layout. If the layout reports no managed path or the file does not exist on disk, the method throws, because the prebuilt AppHost server cannot run without it.","triggerScenarios":"Calling GetServerPath on a layout produced by an incomplete/corrupt CLI install, or after the layout directory was partially deleted or cleaned up while the CLI is running.","commonSituations":"Broken or hand-mangled CLI installation, antivirus quarantining the managed binary, staging-directory cleanup removing the file before it is used, or an out-of-date layout manifest.","solutions":["Reinstall the Aspire CLI so the layout is rebuilt with aspire-managed present","Verify the layout directory actually contains the aspire-managed binary and restore it if missing","Check antivirus/quarantine logs if the file existed previously but disappeared"],"exampleFix":"// before\nvar serverPath = server.GetServerPath(); // throws: missing in layout\n// after\n// reinstall CLI to repair layout\n$ curl -fsSL https://aspire.dev/install.sh | bash\nvar serverPath = server.GetServerPath();","handlingStrategy":"fallback","validationCode":"var managedPath = layout.GetManagedPath();\nif (managedPath is null || !File.Exists(managedPath))\n    throw new InvalidOperationException(\"aspire-managed missing; reinstall the Aspire CLI\");","typeGuard":"bool LayoutHasManagedServer(ILayout layout) => layout.GetManagedPath() is { } p && File.Exists(p);","tryCatchPattern":"try { path = server.GetServerPath(); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"aspire-managed not found\"))\n{\n    // reinstall CLI or use fallback server path\n}","preventionTips":["Reinstall the CLI after manual edits to its install directory","Exclude the CLI install location from antivirus quarantine/cleanup","Verify the install layout after upgrading the CLI before launching AppHosts"],"tags":["cli","installation","missing-binary"],"backgroundTag":"file-not-found","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"}