How to enable blazor united on a blazor wasm project? - c#

Based on this video there is a feature called Blazor United.
Blazor United is a prototype project from Steve Sanderson, the original creator of Blazor, which combines the advantages of Razor Pages, Blazor Server, and Blazor WebAssembly into a single stack. The prototype is currently in development and is expected to be included in .NET 8. Some of the features of the prototype include support for traditional server-side rendering, WebAssembly, and WebSockets. Additionally, the prototype includes features such as hot module reloading, lazy loading, and prerendering. The project is still in its early stages, and more features and improvements are expected to arrive in the future.
How to add this to a .net 7 blazor wasm project by this link :
https://github.com/dotnet/aspnetcore/tree/blazor-united

Related

NX monorepo in a dotnet Angular project

I am doing some research for a new project. This project will use .NET/C# for the backend and now I am investigating about the best way to integrate the frontend in the same repository.
There will be multiple client apps like a web based CMS and Android/iOS mobile apps. Because of the team expertise NX, Angular and Ionic has been chosen as client technologies.
I know dotnet has a template to create an Angular SPA project, since there will be multiple client apps and we want to share code between them I wanted to convert it in an NX monorepo but beside this article (not working for me) I didn't find how to do it. I came across nx-dotnet but wraps a C# backend inside a native NX monorepo (I am trying to do the opposite: NX in a dotnet project).
Is there any tool or docs about converting the dotnet Angular template in a monorepo? What is a good practice to share code between multiple client apps in a dotnet solution?
I thought about the following alternatives:
Init the NX monorepo in a folder and treat it like a normal node app (not a dotnet project)
Use Angular Workspace feature

How to Render OpenGL on Android with C#?

I have an existing application written in C# for .NET 6 that renders OpenGL with the lightweight OpenTK (v4) OpenGL bindings, which support .NET 5+, Open GL 3+, and OpenGL ES 2+.
According to the OpenTK FAQ:
OpenTK runs on Windows, Linux, and MacOS X.
(Older versions of OpenTK supported Android and iOS as well; current OpenTK might work on these, but it’s untested.)
I am excited by .NET 6's promise of one unified platform, but I have only seen cross-platform mobile projects that use Microsoft's new .NET Multi-platform App UI (.NET MAUI) framework. MAUI appears to be a web view shell that contains a Blazor Web App. I found the code for this shell in the src/Core/AndroidNative folder of the repository, but it seems very bloated for my purposes. I want to be able to access Android-specific functions without the bloat of Blazor and a web view. According to this blog post, Xamarin.Android might be the answer, but I am not sure how to introduce it into my existing project.
All I need is a simple shell that:
Creates an Activity with a GLSurfaceView
Obtains an OpenGL ES 2 context
Runs my current C# code with that context
I would prefer the shell to be in C#, since introducing Java code would complicate my build process and fragment my code base.
How can I introduce the needed Android-specific code?
How will this change my build process?
I know that I need to write OpenGL ES-compatible shaders and that I probably need to change how I save files. What other changes will I need to make to my current code to ensure Android compatibility?

C# WASM without Blazor

I want to be able to call C# code from JavaScript. The mono project used to have a WASM SDK that you could download from their old Jenkins server, but that is no longer public. Existing docs tend to point toward those builds. The Azure Devops builds do not include this SDK. A few messages I've seen on their Github account indicate that they are now focusing on the .NET 6 for WASM. I do not wish to use the Blazor components. Is there a way in .NET 6 to build a minimally sized WASM binary without the Blazor UI?
Yes it's absolutely possible. Blazor does not have a monopoly on C#/WASM and it's far from clear that it's going to wind up being the best long term option (and a lot of evidence it's not).
I recommend starting with the Uno WASM Bootstrap. https://github.com/unoplatform/Uno.Wasm.Bootstrap
2022-06-30 Edit -
More evidence Blazor is not the only game in town nor even at the forefront of innovation here:
https://visualstudiomagazine.com/articles/2022/06/29/uno-platform-4-4.aspx
The Mono WASM SDK is continued in the dotnet/runtime repo. The tooling based on old Packager.exe has evolved into a MSBuild/csproj based solution:
https://github.com/dotnet/runtime/tree/main/src/mono/wasm
samples:
https://github.com/dotnet/runtime/tree/main/src/mono/sample/wasm
The key issue when I trying to use code in a custom project (not within the sample) is that we need to reference a private assembly System.Private.Runtime.InteropServices.JavaScript.dll which is included in Microsoft.NETCore.App.Runtime.browser-wasm. The code is almost the same as WebAssembly.Bindings.dll in old mono wasm sdk.
Here is a screenshot of a WebGL page I created, based on dotnet/runtime/mono/wasm:
BTW there is a viewpoint that the performance of implementing WebGL via calling JavaScript functions from C#, is bad: https://marcoscobena.com/?i=wave-engine-web-performance
NativeAOT-LLVM, an experimental c# compiler not official supported by Microsoft, (https://github.com/dotnet/runtimelab/tree/feature/NativeAOT-LLVM) can also compile C# to Wasm without any UI framework requirements. There's a similar question about libraries at Compiling C# project to WebAssembly
It seems that dotnet 7 has improved WASM support. More information is provided in https://devblogs.microsoft.com/dotnet/dotnet-7-wasm/

Unity3D: Cannot change scripting backend to .NET

Currently, the scripting backend is IL2CPP. I need to change it to .NET. I am not sure why it is disabled.
I tried to add component via Unity Hub. It doesn't have Add component option and there was no option in Unity Installer as well.
How do I change it to .NET?
You can't
Per the documentation Unity deprecated the .NET backend and only IL2CPP remains.
Note: The .NET scripting backend is deprecated and will be removed in a future release of Unity. We recommend switching to the IL2CPP scripting backend.
Given that that page is for Unity 2018.2 the feature has been removed in Unity 2019, which the current documentation page supports.
L2CPP is the only scripting back end supported for building projects for Universal Windows Platform.
Any other references saying that UWP supports a .NET backend haven't been updated to reflect this change.
See also this Microsoft MR issue on GitHub.

Angular vs Angular CLI vs NPM (Version, Usage & Dependency)

Can anyone clear angular, angular cli & npm? I am going to start with Angular project. Unfortunately my client already have project developed in some version of Angular (+.net core). I am newbie to angular.
I am trying to configuring that project on my local machine and facing too many version conflicts error. Submitting those error (one by one) here doesn't make any sense to me. Rather, I would need more clarity/intro/relations between angular, angular cli & npm.
Thanks.
Well, Angular is Angular. Angular CLI is a command developed in Node that helps you generate the boilerplate of an Angular project, so you don't have to do the repetitive, error prone work of preparing a new project by hand. This command uses npm to download the different dependencies the generated boilerplate needs.
Angular CLI let's you start a development web server too, to assist you during the development.
This is a very high level explanation. If you are totally new to Angular + .NET Core development, I would recommend you to check this book. It helped me a lot when I was in your position.

Categories