microsoft/aspire · error · DistributedApplicationException
The ResolveWebAssemblyProjectReferences MSBuild target…
Error message
The ResolveWebAssemblyProjectReferences MSBuild target returned no output for '{serverProjectPath}'. What it means
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.
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.
Example fix
<!-- before: server has no WASM client reference --> <!-- after --> <ItemGroup> <ProjectReference Include="..\Client\Client.csproj" /> </ItemGroup>
Defensive patterns
Strategy: validation
Validate before calling
var output = Process.Run("dotnet", $"msbuild {serverProjectPath} -t:ResolveWebAssemblyProjectReferences").StandardOutput;
if (string.IsNullOrWhiteSpace(output)) throw new InvalidOperationException("No WASM client project resolved; server likely lacks a Blazor WebAssembly client reference."); Try / catch
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; } Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- Failed to discover the Blazor WebAssembly client project for
- Failed to parse the ResolveWebAssemblyProjectReferences…
- GatewayAppsAnnotation not found on resource.
- Publishing a DotnetProjectResource-backed Blazor gateway is…
- The gateway ' ' must define an HTTP or HTTPS endpoint.
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/21eb6218541c1610.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.Hosting.Blazor/BlazorHostedExtensions.cs:245
? new DistributedApplicationException(message, result.StartException)
: new DistributedApplicationException(message);
}
if (result.ExitCode != 0)
{
BlazorGatewayLog.WasmClientDiscoveryFailed(
logger,
serverProjectPath,
result.StandardOutput,
result.StandardError);
throw new DistributedApplicationException(
$"Failed to discover the Blazor WebAssembly client project for '{serverProjectPath}'. " +
$"The ResolveWebAssemblyProjectReferences MSBuild target exited with code {result.ExitCode}.");
}
if (string.IsNullOrWhiteSpace(result.StandardOutput))
{
throw new DistributedApplicationException(
$"The ResolveWebAssemblyProjectReferences MSBuild target returned no output for '{serverProjectPath}'.");
}
try
{
using var output = JsonDocument.Parse(result.StandardOutput);
// MSBuild emits:
// { "Items": { "WebAssemblyProjectReference": [{ "Identity": "/path/Client.csproj" }] } }
if (output.RootElement.TryGetProperty("Items", out var items)
&& items.TryGetProperty("WebAssemblyProjectReference", out var projectReferences))
{
foreach (var projectReference in projectReferences.EnumerateArray())
{
if (projectReference.TryGetProperty("Identity", out var identity)
&& identity.GetString() is { Length: > 0 } projectPath)
{
return Path.GetFullPath(projectPath, serverDirectory);View on GitHub (pinned to 25830f84bd)