Skip to content

.NET 10 Incompatibility with WebApp-to-WebApp Static Assets Referencing (affects GrandNode2) #615

@CancanTang

Description

@CancanTang

Just a quick heads-up: while testing .NET 10, we noticed a potential compatibility issue that affect GrandNode2 app.

Specifically, if there are references between web projects (WebApp → WebApp) that depend on loading static assets via _content/XXX paths, this is no longer supported in .NET 10.

The issue is tracked here:
👉 dotnet/aspnetcore#62138

Summary:
.NET 10 introduces a change where WebApp-to-WebApp references are not supported for static web assets. Previously, static assets could sometimes be shared across web projects, but in .NET 10, the SDK explicitly restricts this behavior.

WebApps now define static asset base paths as /, which prevents referencing their _content/XXX assets from other web apps.

This scenario is officially unsupported.

The workaround is to manually set the base path in the referenced project using:
<StaticWebAssetBasePath>_content/$(MSBuildProjectName)</StaticWebAssetBasePath>

Repro steps:

  1. The machine has dotnet-sdk-10.0.100-preview.5.25272.110 installed.
  2. Create a global.json file to make it target .NET 10.
  3. Run the command dotnet build in the grandnode2\src\Web\Grand.Web directory.

Build failed with error:
Conflicting assets with the same target path 'assets/images/flags/ad#[.{fingerprint}]?.png'. For assets 'Identity: D:\grandnode2\src\Web\Grand.Web.Admin\wwwroot\assets\images\flags\ad.png, SourceType: Project, SourceId: Grand.Web.Admin, ContentRoot: D:\grandnode2\src\Web\Grand.Web.Admin\wwwroot\, BasePath: /, RelativePath: assets/images/flags/ad#[.{fingerprint}]?.png, AssetKind: All, AssetMode: All, AssetRole: Primary, AssetRole: , AssetRole: , RelatedAsset: , AssetTraitName: , AssetTraitValue: , Fingerprint: 1smjfebmi3, Integrity: EZFwYCjTmh1ez2xocsIWUdYRgowFz+BGwrL1GuPYpNI=, FileLength: 326, LastWriteTime: 8/8/2024 2:51:31 AM +00:00, CopyToOutputDirectory: Never, CopyToPublishDirectory: PreserveNewest, OriginalItemSpec: wwwroot\assets\images\flags\ad.png' and 'Identity: D:\grandnode2\src\Web\Grand.Web.Vendor\wwwroot\assets\images\flags\ad.png, SourceType: Project, SourceId: Grand.Web.Vendor, ContentRoot: D:\grandnode2\src\Web\Grand.Web.Vendor\wwwroot\, BasePath: /, RelativePath: assets/images/flags/ad#[.{fingerprint}]?.png, AssetKind: All, AssetMode: All, AssetRole: Primary, AssetRole: , AssetRole: , RelatedAsset: , AssetTraitName: , AssetTraitValue: , Fingerprint: 1smjfebmi3, Integrity: EZFwYCjTmh1ez2xocsIWUdYRgowFz+BGwrL1GuPYpNI=, FileLength: 326, LastWriteTime: 8/8/2024 2:51:58 AM +00:00, CopyToOutputDirectory: Never, CopyToPublishDirectory: PreserveNewest, OriginalItemSpec: wwwroot\assets\images\flags\ad.png' from different projects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions