{"record":{"id":"21eb6218541c1610","repo":"microsoft/aspire","slug":"the-resolvewebassemblyprojectreferences-msbuild-target","errorCode":null,"errorMessage":"The ResolveWebAssemblyProjectReferences MSBuild target returned no output for '{serverProjectPath}'.","messagePattern":"The ResolveWebAssemblyProjectReferences MSBuild target returned no output for '(.+?)'\\.","errorType":"exception","errorClass":"DistributedApplicationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.Blazor/BlazorHostedExtensions.cs","lineNumber":245,"sourceCode":"                ? new DistributedApplicationException(message, result.StartException)\n                : new DistributedApplicationException(message);\n        }\n\n        if (result.ExitCode != 0)\n        {\n            BlazorGatewayLog.WasmClientDiscoveryFailed(\n                logger,\n                serverProjectPath,\n                result.StandardOutput,\n                result.StandardError);\n            throw new DistributedApplicationException(\n                $\"Failed to discover the Blazor WebAssembly client project for '{serverProjectPath}'. \" +\n                $\"The ResolveWebAssemblyProjectReferences MSBuild target exited with code {result.ExitCode}.\");\n        }\n\n        if (string.IsNullOrWhiteSpace(result.StandardOutput))\n        {\n            throw new DistributedApplicationException(\n                $\"The ResolveWebAssemblyProjectReferences MSBuild target returned no output for '{serverProjectPath}'.\");\n        }\n\n        try\n        {\n            using var output = JsonDocument.Parse(result.StandardOutput);\n\n            // MSBuild emits:\n            // { \"Items\": { \"WebAssemblyProjectReference\": [{ \"Identity\": \"/path/Client.csproj\" }] } }\n            if (output.RootElement.TryGetProperty(\"Items\", out var items)\n                && items.TryGetProperty(\"WebAssemblyProjectReference\", out var projectReferences))\n            {\n                foreach (var projectReference in projectReferences.EnumerateArray())\n                {\n                    if (projectReference.TryGetProperty(\"Identity\", out var identity)\n                        && identity.GetString() is { Length: > 0 } projectPath)\n                    {\n                        return Path.GetFullPath(projectPath, serverDirectory);","sourceCodeStart":227,"sourceCodeEnd":263,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.Blazor/BlazorHostedExtensions.cs#L227-L263","documentation":"After ResolveWebAssemblyProjectReferences exits successfully, the method parses the target's stdout as JSON containing the client project path. When the target exits 0 but emits no output, the library throws a DistributedApplicationException because there is nothing to parse.","triggerScenarios":"Running the MSBuild ResolveWebAssemblyProjectReferences target on a Blazor server project whose client references were not resolved (no WASM client project referenced, or the target matched nothing) so stdout is empty/whitespace.","commonSituations":"Blazor server project without a referenced WebAssembly client; project layout where discovery returns nothing; MSBuild target silently no-op due to wrong properties or custom SDK setup.","solutions":["Reference a Blazor WebAssembly client project from the server project so the MSBuild target emits a result.","Verify manually: run `dotnet msbuild <server.csproj> -t:ResolveWebAssemblyProjectReferences` and inspect output.","Explicitly configure the client project path in code rather than relying on MSBuild auto-discovery.","Check for custom Directory.Build.props/targets suppressing the target and remove ProjectReference ambiguity."],"exampleFix":"<!-- before: server has no WASM client reference -->\n<!-- after -->\n<ItemGroup>\n  <ProjectReference Include=\"..\\Client\\Client.csproj\" />\n</ItemGroup>","handlingStrategy":"validation","validationCode":"var output = Process.Run(\"dotnet\", $\"msbuild {serverProjectPath} -t:ResolveWebAssemblyProjectReferences\").StandardOutput;\nif (string.IsNullOrWhiteSpace(output)) throw new InvalidOperationException(\"No WASM client project resolved; server likely lacks a Blazor WebAssembly client reference.\");","typeGuard":null,"tryCatchPattern":"try { await ResolveBlazorWasmClientProjectPathAsync(...); } catch (DistributedApplicationException ex) when (ex.Message.Contains(\"returned no output\")) { logger.LogError(ex, \"Server project did not resolve any WASM client\"); throw; }","preventionTips":["Reference a Blazor WebAssembly client project from the server project.","Verify the MSBuild target emits JSON output before relying on auto-discovery.","Provide the client path explicitly when project layout is non-standard."],"tags":["blazor","msbuild","wasm","empty-output","discovery"],"backgroundTag":"empty-result-set","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"}