1

A while ago, I created a Blazor 7 Server project which I now **successfully ** migrated to .NET 8.

I have multiple questions regarding Blazor :

  • Does my project has the ability to be rendered dynamically Server/WebAssembly/Auto like Blazor 8 ?
  • I don't have the Server and .Client Project in the architecture as in a newly created Blazor 8 project. Like so :A newly BLazor 8 project

Here is what I have Project from Migration to .NET 8

Is there any backslash for not creating directly a Blazor 8 WebApp ? It seems that I don't have anything using webassembly...

On the mid run will I regret not creating directly from Blazor 8 ? What will i miss if I don't have the same architecture project as a newly Blazor .NET 8 project ? I have now "client" project.

1
  • 1
    What do you want? If you successfully migrated then your there. If you want to create a multi-type application then you need to start re-organising your code so you can do so. Be aware that such a solution is complex. Do you have the knowledge to do it? Your questions can only be answered by you. We are not intimate with your project, the requirements or future needs. Here's a personal commentary of mine on the subject - github.com/ShaunCurtis/Blazor.ExploreRendering/blob/master/… Commented Feb 1 at 22:19

1 Answer 1

1

You do not need to start with a completely new project. Migration is very much possible although depending on how big your application is (from a first look, it looks rather small) it might be quicker/ easier to start with a new template and just copy over the pages and sites and add @rendermode directives etc. as required. To do the migration a little more understanding of how Blazor works is required (although you should definitely have this anyway if you want to run Blazor in production). Using Server/ WebAssembly and Auto render modes makes things quite a bit more complex.

So one important thing to note is that when you only have a single project you cannot simply add WebAssembly support to some of the components because for that to work an .NET Assembly has to be compiled to WebAssembly. That means you will need to create a client project which will then be compiled to WebAssembly.

You can however also create a shared project and re-use components in the client and server projects. In that case however you need to make sure that you always fetch the data how you would do it in Blazor WebAssembly e.g. via an HTTP call as in Blazor Server that whole thing works out-of-the-box with the SignalR connection, which you don't have in WebAssembly.

I cannot give you an detailed migration guide here, but you should absolutely check out the video on Blazor in .NET 8 from .NET Conf where the new concepts and when what get's rendered where is explained. I would also recommend to read Chris Sainty's (Microsoft MVP) blog post on that topic.

Also there are detailed migration guides by Micorsoft (See Migrate from ASP.NET Core 7.0 to 8.0 - Blazor).

These guides also specifically mention transitioning from Blazor Server to have some/ all functionality available in WebAssembly.

2
  • Right now by default I am in server render mode ?
    – Benoît S
    Commented Mar 19 at 21:44
  • The default on .NET 8 is actually static server-side rendering, which means no interactivity. But it's not hard to configure you application to globally use interactive server mode. See MS Docs - Render Modes. Commented Mar 19 at 22:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.