.NET 8 + Blazor In OC Module? #15593
Replies: 5 comments 4 replies
-
While I won't be able to help with Blazor, be sure to check these out: |
Beta Was this translation helpful? Give feedback.
-
Thanks @Piedone , Your first link seems to hint that what I am doing is entirely possible (and I don't know why it wouldn't be). I had actually cloned those other sample repos over the last few days and none of them seem to be showing what I am wanting. The "Add Blazor guide" seems to address the decoupled CMS - so it's only using the Targets package and everything else is basically a standalone app (blazor). What I need is to integrate Blazor into an existing module using the Full CMS. |
Beta Was this translation helpful? Give feedback.
-
Starting to wonder if there is just some issue in the guts of OCs implementation of RazorPage? Clearly OC is doing something very different here than what regular MVC does - I'm guessing to facilitate modules and themes for OC, but somewhere in the guts of that, it's fundamentally different, which is preventing Blazor components from working. Any ideas? |
Beta Was this translation helpful? Give feedback.
-
Should I just create an issue from this discussion? Was holding off until I figured out if it was me or just something in OC. Starting to think this is an OC issue. @Piedone, thoughts? |
Beta Was this translation helpful? Give feedback.
-
Looks like is an open issue that addresses a related concern. Pulled the 1.9.0 preview packages and the Blazor component now renders. Guess just a matter of time. Closing. |
Beta Was this translation helpful? Give feedback.
-
Is there an updated example somewhere that shows how to add a new Blazor component to an existing OC Module?
My project has a project for the main system, and various module projects. I want to rewrite part of one module (which was some incredibly funky javascript work) in Blazor. Basically just one view in that module (which has a few views) has something of a client-side experience that was written in knockout (old). I want to move that to Blazor as a PoC - and pave the way for further adoption if possible.
I am having trouble getting everything to line up - seems the last time I touched Startup.cs has been a few years and the later OC examples are a bit different. I just updated to .net 8 yesterday and have the main app + theme + modules all working. Now, just can't seem to get Blazor to plug in nicely.
I keep getting "The type or namespace name 'Components' does not exist in the namespace 'redacted' (are you missing an assembly reference?). I'm not. :) Oddly, when I open the error site and hover, VS clearly knows that the object is and I can right-click and go to definition. So something in vs build is complaining for nothing?
To get here, I added a new Blazor Web App (.net 8) project. Looks to be setup like the default project, with my own simple Components/Message.razor file. No Pages - I just want something simple to start.
_Imports.razor has @using for the component.
Orchard module (server side) startup.cs has this.
`
endpointRouteBuilder.MapRazorComponents()
.AddInteractiveServerRenderMode()
.AddInteractiveWebAssemblyRenderMode()
.AddAdditionalAssemblies(typeof(redacted.Blazor._Imports).Assembly);
In the module ConfigureServices method I have this.
services.AddRazorComponents() .AddInteractiveServerComponents() .AddInteractiveWebAssemblyComponents();
I have tried various combinations of this stuff and found nothing that gets rid of the error and lets it work.
Module has a route to
Test/TestBlazor and I have a views folder
Views/Test/TestBlazor.cshtml
That file looks like this
``
@using redacted.Blazor.Components
@t["Hello from Module 1!"]
Any ideas or updated PoCs to peek at?
Beta Was this translation helpful? Give feedback.
All reactions