Skip to content

Static web assets: Release build/publish of a net10.0-macos Web SDK project fails - manifest only written per RID, read from the RID-less folder #56854

Open

Description

@visioforge

Symptom

A net10.0-macos Web SDK project builds in Debug, but dotnet build -c Release and dotnet publish fail:

.../Sdks/Microsoft.NET.Sdk.StaticWebAssets/targets/Microsoft.NET.Sdk.StaticWebAssets.References.targets(16,5):
error : Manifest file at 'obj/Release/net10.0-macos/staticwebassets.build.json' not found.

Environment

macOS 27.0 (arm64), .NET SDK 10.0.403, microsoft.net.sdk.macos workload 27.0.10742, ASP.NET Core shared framework 10.0.14.

Minimal repro

probe.csproj:

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>net10.0-macos</TargetFramework>
    <ApplicationId>com.example.probe</ApplicationId>
    <ServerGarbageCollection>false</ServerGarbageCollection>
    <RunWithOpen>false</RunWithOpen>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>
</Project>

Program.cs:

var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.UseStaticFiles();
app.MapGet("/", () => "hi");
app.Run();

plus wwwroot/css/site.css. No VisioForge or other package involved.

  • dotnet build (Debug) → succeeds.
  • dotnet build -c Release → the error above, reported twice.
  • dotnet publish -c Release → same error.
  • dotnet build -c Release -p:RuntimeIdentifier=osx-arm64 → succeeds.

Cause

In Release the macOS SDK turns the build into a multi-RID one: dotnet build -c Release -getProperty:RuntimeIdentifiers returns osx-x64;osx-arm64 (Xamarin.Shared.Sdk.props, "For release desktop builds we default to universal apps").

The static web assets manifests therefore land per RID:

obj/Release/net10.0-macos/osx-arm64/staticwebassets.build.json
obj/Release/net10.0-macos/osx-x64/staticwebassets.build.json

while _CleanupReferencedProjectItemGroups (Microsoft.NET.Sdk.StaticWebAssets.References.targets:16) reads $(StaticWebAssetBuildManifestPath), which for that configuration resolves to obj/Release/net10.0-macos/staticwebassets.build.json — a path the RID-less build never writes (obj/Release/net10.0-macos/staticwebassets/ is empty, dotnet build -c Release -t:GenerateStaticWebAssetsManifest on the RID-less configuration writes nothing).

In Debug the macOS SDK uses one RID (the host's), the manifest lands in obj/Debug/net10.0-macos/osx-arm64/, and the reader finds it.

Expected

dotnet build -c Release and dotnet publish succeed for a net10.0-macos Web SDK project, either because the RID-less configuration also writes the manifest it reads, or because the reading target is skipped/bound to the RID-specific manifests in a multi-RID build.

Workaround

Pin a single runtime identifier in the project file:

<RuntimeIdentifier Condition="$([MSBuild]::IsOsPlatform('MacOS')) and '$(RuntimeIdentifier)' == ''">$(NETCoreSdkRuntimeIdentifier)</RuntimeIdentifier>

That yields one build configuration, so the manifest path and the reader agree; dotnet build -c Release and dotnet publish -c Release then work. Passing -p:RuntimeIdentifier=osx-arm64 on the command line is not equivalent when the project has ProjectReferences to multi-targeted (iOS/Mac Catalyst/macOS) projects: the global property flows into those legs and restore fails with NU1102 for Microsoft.NETCore.App.Runtime.Mono.osx-arm64.

Note on the publish path

With the workaround, dotnet publish -c Release produces an app bundle whose Contents/Resources contains the static web assets only if the project copies them there itself; the macOS SDK's own bundling of wwwroot warns The path '...' would result in a file outside of the app bundle and cannot be used (_CollectBundleResources), which is a separate gap: a net10.0-macos ASP.NET Core app has no publishing recipe for its web files.

Activity

  1. added
    untriaged
    on Oct 30, 2026
  2. locked and limited conversation to collaborators on Oct 30, 2026
  3. unlocked this conversation on Oct 30, 2026
  4. removed
    untriaged
    on Oct 30, 2026
  5. github-actions commented on Oct 30, 2026

    @github-actions
    Contributor

    🎯 Agentic Issue Triage

    Triage Assessment:

    • 🏷️ Labels: Area-StaticWebAssets Bug
    • 💻 Assignment: @javiercn | @dotnet/aspnet-blazor-eng
    • 🟩 Confidence: high - The issue directly names Static Web Assets targets and gives a clear repro.

    ➡️ Summary: Release build/publish of a net10.0-macos Web SDK project fails because the static web assets manifest is written per RID but read from the RID-less path. Follow up by making the reading target RID-aware or skipping it in multi-RID builds.

    Generated by 🏷️ Issue Triage for #56854 · copilot · auto · 17.5 AIC · ⌖ 0.677 AIC · ⊞ 14.4K · ◷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions