Skip to content

Fix BlazorUnitedApp sample missing shared framework references#65292

Merged
ilonatommy merged 1 commit intodotnet:mainfrom
ilonatommy:fix-blazor-sample
Feb 4, 2026
Merged

Fix BlazorUnitedApp sample missing shared framework references#65292
ilonatommy merged 1 commit intodotnet:mainfrom
ilonatommy:fix-blazor-sample

Conversation

@ilonatommy
Copy link
Member

Description

Problem

After #64863, running the BlazorUnitedApp sample fails at runtime with:

System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.Hosting, Version=11.0.0.0...'

Root Cause

PR #64863 replaced RemoveSharedFrameworkDependencies.cs with PrivateAssets=all metadata for shared framework references. As part of this change, sample projects needed explicit <Reference> items added for all their runtime dependencies.

The BlazorUnitedApp.csproj was updated with some references, but many were missing - particularly those required for Blazor Server apps with interactive components (Kestrel, SignalR, Authentication, DataProtection, etc.).

Fix

Added the missing <Reference> items to BlazorUnitedApp.csproj:

  • Microsoft.AspNetCore.Authentication
  • Microsoft.AspNetCore.Hosting
  • Microsoft.AspNetCore.Server.Kestrel (and related transport assemblies)
  • Microsoft.AspNetCore.SignalR (and related assemblies)
  • Microsoft.AspNetCore.DataProtection (and related assemblies)
  • Several other required assemblies

Testing

Verified the sample runs successfully with:

. .\activate.ps1
dotnet run --project src\Components\Samples\BlazorUnitedApp\BlazorUnitedApp.csproj /p:UseIisNativeAssets=false

@ilonatommy ilonatommy added this to the .NET 11 Planning milestone Feb 2, 2026
@ilonatommy ilonatommy requested a review from a team as a code owner February 2, 2026 14:24
@ilonatommy ilonatommy added the area-blazor Includes: Blazor, Razor Components label Feb 2, 2026
Copilot AI review requested due to automatic review settings February 2, 2026 14:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the BlazorUnitedApp sample failing at runtime due to missing shared framework assembly references after the shared-framework dependency flow change in #64863.

Changes:

  • Adds explicit <Reference> items to BlazorUnitedApp.csproj for required ASP.NET Core runtime dependencies (Hosting, Kestrel, SignalR, DataProtection, etc.).
  • Ensures the sample has the necessary assemblies available at runtime for interactive server components scenarios.

@ilonatommy ilonatommy self-assigned this Feb 2, 2026
@ilonatommy ilonatommy requested a review from wtgodbe February 2, 2026 14:39
@ilonatommy
Copy link
Member Author

@wtgodbe, please let us know if any neater way comes to your mind.

Copy link
Member

@oroztocil oroztocil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful 😌

@oroztocil
Copy link
Member

What about the BlazorServerApp? If we want to keep it around, it needs to be fixed as well.

Copy link
Member

@wtgodbe wtgodbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is the right fix

@ilonatommy
Copy link
Member Author

What about the BlazorServerApp? If we want to keep it around, it needs to be fixed as well.

blazorserver template was deprecated starting with .net 8. I think we could remove it from the samples as net 7 had its end of support in 2024. Not in this PR ;)

@ilonatommy ilonatommy merged commit fa518d5 into dotnet:main Feb 4, 2026
32 checks passed
@wtgodbe wtgodbe modified the milestones: 11.0-preview1, 11.0-preview2 Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-blazor Includes: Blazor, Razor Components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants