Skip to content

RenderMode not working with razor class libraries #52129

@musictopia2

Description

@musictopia2

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When I create a project that has a razor class library and I try to use this code
@rendermode InteractiveAuto
and try to compile that library, it always fails to compile because does not know anything about @rendermode

Works fine when using under blazorwebapp.
However, some cases i need razor class library so I can share with blazor hybrid and use other places as well.

Expected Behavior

The expected behavior is for the project to compile and run.
When using web, then do as promised on the counter where it first uses blazor server and the next time web assembly (since the components would have been downloaded).

Steps To Reproduce

  1. Create blank solution
  2. Create blazor web app
  3. Create maui blazor hybrid
  4. Create shared library
  5. Move the Counter from blazor web app client to the shared
  6. Make the necessary changes necessary including referencing the proper projects and putting in the additional assemblies
  7. Run
  8. Will always fail to load (even the blazor web app).

Exceptions (if any)

Severity Code Description Project File Line Suppression State
Error (active) CS0103 The name 'InteractiveAuto' does not exist in the current context

.NET Version

8

Anything else?

No response

Metadata

Metadata

Assignees

Labels

area-blazorIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.feature-full-stack-web-uiFull stack web UI with Blazor

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions