Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Blazor Hybrid on Linux/Ubuntu #11738

Open
RChrisCoble opened this issue Nov 29, 2022 · 68 comments
Open

Support Blazor Hybrid on Linux/Ubuntu #11738

RChrisCoble opened this issue Nov 29, 2022 · 68 comments
Labels
area-blazor Blazor Hybrid / Desktop, BlazorWebView platform/linux 🐧 proposal/open t/enhancement ☀️ New feature or request
Milestone

Comments

@RChrisCoble
Copy link

Hello ASP.NET & MAUI Team! @danroth27, @davidortinau, @Eilon

Now that Blazor Hybrid has gone through a good stabilization and performance release with .NET 7, I'd like to put a request in to consider Blazor Hybrid support on Linux with Ubuntu. The Edge browser for Linux has been released and stabilized for about a year now.

For our usages, we're standardizing on the Blazor Hybrid/MAUI "One code base and one UI layer" vision by taking our large desktop WPF application first to a SaaS Blazor WASM application then deliver that same application on Mobile (iOS/Android), then onto the native desktop application on Windows and we know already we need to get to smaller footprint/panel devices which run Linux.

We need the smallest memory/CPU profile possible on these Linux devices, so we'd far prefer to run the .NET business logic code natively on the device instead of running that on WASM.

@javiercn javiercn transferred this issue from dotnet/aspnetcore Nov 29, 2022
@janseris

This comment was marked as off-topic.

@rachelkang rachelkang added t/enhancement ☀️ New feature or request proposal/open area-blazor Blazor Hybrid / Desktop, BlazorWebView Blazor ❤️ MAUI Issues in MAUI functionality that affect Blazor, but are not bugs in Blazor itself labels Nov 29, 2022
@mkArtakMSFT mkArtakMSFT added area-blazor Blazor Hybrid / Desktop, BlazorWebView and removed area-blazor Blazor Hybrid / Desktop, BlazorWebView labels Nov 30, 2022
@mkArtakMSFT
Copy link
Member

@Redth, @davidortinau what should this be duped against? I've learned that there are multiple issues now tracking Linux support in MAUI.

@RChrisCoble
Copy link
Author

@jayschmelzer I'd like to request this issue gets on your radar for tracking. Support of Linux here is critical for us. Thanks.

@danroth27, @davidortinau.

@Eilon
Copy link
Member

Eilon commented Dec 2, 2022

@RChrisCoble - just to check: are you asking for .NET MAUI Blazor Hybrid on Linux, or specifically BlazorWebView? That is, much like we have BlazorWebView for WPF and WinForms, we would have this full suite:

  1. .NET MAUI BlazorWebView (works on Windows, Mac, iOS, Android)
  2. WinForms BlazorWebView
  3. WPF BlazorWebView
  4. New Linux BlazorWebView <-- is that what you're looking for?

@Eilon Eilon removed the Blazor ❤️ MAUI Issues in MAUI functionality that affect Blazor, but are not bugs in Blazor itself label Dec 2, 2022
@RChrisCoble
Copy link
Author

@Eilon! Hope you're doing well. I'll answer with our desired UC to be clear.

We want to take our Blazor application and run it in a Blazor Hybrid deployment on Windows, iOS, Android, and Linux. I don't believe we care about the shell technology hosting the BlazorWebView (WPF, WinForms, or MAUI).

I'm assuming:

  • WinForms and WPF would only apply to Windows environments for BlazorWebView.
  • We need MAUI to support iOS, Android, and in the (hopeful) future Linux.

So, #4 to close the gap with #1

@Eilon
Copy link
Member

Eilon commented Dec 3, 2022

Alright, so right now you want "a way to run Blazor Hybrid as a Linux GUI app". Whether you have access to the various .NET MAUI APIs (such as Maui Essentials), or any other native UI controls, is not a critical factor for you? You'd still have access to everything that .NET itself supports in Linux, like file system, networking, and most other System.* APIs. But no other native GUI stuff.

@RChrisCoble
Copy link
Author

RChrisCoble commented Dec 3, 2022

Right, no native GUI. We’re not using Maui essentials (yet), but I suspect we might introduce that in iOS and Android usages for mobile device UC’s, but that wouldn’t be required on Linux. So, just as you described, a “Blazor Hybrid as a Linux GUI app”.

Now if you could also ensure it works with EmbeddedLinux using FrameBuffer rendering that would be ideal. (Sarcasm)

@mkArtakMSFT mkArtakMSFT added this to the .NET 8 Planning milestone Dec 6, 2022
@hedi-sel
Copy link

We'd love to be able to support Linux
Thanks for raising this issue<3

@danroth27
Copy link
Member

For folks interested in Blazor Hybrid Linux support, could you share with us what sort of Linux device hardware you need to support? Is this for users running Linux on a PC/laptop? Or is this for some sort of embedded scenario? Are these devices indicative of a particular market or user base that you're trying to address where Linux is particularly important? Do you expect to have a significant user base running your apps on Linux or is this more about being able to say that can run on Linux even though you don't expect significant usage? The more details you can share on the specific hardware and target audience the better. Thanks!

@RChrisCoble
Copy link
Author

RChrisCoble commented Dec 15, 2022

Thanks @danroth27.

For our UC's, we're targeting embedded with attached screens running some version of Ubuntu. We did some POC's and were able to run our .NET graphic rendering engine with SkiaSharp down at the FrameBuffer level, but that required us consuming various components from Avalonia along with using Avalonia's SkiaSharp branch. The business decided that wasn't feasible for the long term from an investment standpoint as that tech stack didn't include any Blazor support.

We have some future POC's lined up to see how "small" we can get, and for now that requires a full browser like Edge to be present, since the application is ultimately Blazor. There would need to be backend services for telemetry feeding the browser client in this scenario. I believe we can get even smaller from a performance and memory footprint standpoint with a Blazor Hybrid app, also giving us access to the local resources on the device, which we also need. (I realize Edge is still in play there with Blazor Hybrid, but the .NET code is outside and not WASM based).

Performance is always high priority in our UC's.

How "small" we can ultimately get will drive the hardware requirements, so I'm a bit in a chicken and egg situation there.

The "devices indicative of a particular market or user base" is local control of machines using an "HMI" (Human Machine Interface). We're looking to support large workloads all the way to small(ish) devices with the same code base and UI layer. Blazor baby!

@RChrisCoble
Copy link
Author

RChrisCoble commented Dec 15, 2022

All this can probably be better summarized by stating the following obvious IOT type scenario:

I build my IOT Visualization solution in the cloud via SaaS tooling then deploy to the Edge.

The Edge could be robust industrial grade PC's all the way down to embedded devices. Our industry is NEVER without local control (the HMI part). No customer will accept plant operations going down if the internet connection is severed.

@JensNordenbro
Copy link

JensNordenbro commented Dec 24, 2022

I want this for HMI imx8mplus scenarios. I.e. Arm64. Arm32 would nice but arm64 a minimum.

@bxjg1987
Copy link

I'm in China. We have many Linux PC users, and many embedded development needs Linux. I hope maui can support it

@JensNordenbro
Copy link

jsuarezruiz#37 seems to mention BlazorWebView compiling

@charleypeng
Copy link

charleypeng commented Jan 12, 2023

yes we use linux as the main company system for now. blazor wasm is slow, and lack of local device controll, so adding blazorwebview feature is a great news for me, and hopefully in the near future, maui controlls and essentials will also be added for linux users.

@charleypeng
Copy link

For folks interested in Blazor Hybrid Linux support, could you share with us what sort of Linux device hardware you need to support? Is this for users running Linux on a PC/laptop? Or is this for some sort of embedded scenario? Are these devices indicative of a particular market or user base that you're trying to address where Linux is particularly important? Do you expect to have a significant user base running your apps on Linux or is this more about being able to say that can run on Linux even though you don't expect significant usage? The more details you can share on the specific hardware and target audience the better. Thanks!

we are using ubuntu linux desktop for our professional work monitor with gnome installed. So blazorwebview like in maui and wpf is needed. and it would be great if it can be added as a controll in Avalonia.

@rgbav
Copy link

rgbav commented Jan 17, 2023

For folks interested in Blazor Hybrid Linux support, could you share with us what sort of Linux device hardware you need to support? Is this for users running Linux on a PC/laptop? Or is this for some sort of embedded scenario? Are these devices indicative of a particular market or user base that you're trying to address where Linux is particularly important? Do you expect to have a significant user base running your apps on Linux or is this more about being able to say that can run on Linux even though you don't expect significant usage? The more details you can share on the specific hardware and target audience the better. Thanks!

Ubuntu amd64. It's hard to determine how big the usage will be right now.

@jrhodnik
Copy link

For folks interested in Blazor Hybrid Linux support, could you share with us what sort of Linux device hardware you need to support? Is this for users running Linux on a PC/laptop? Or is this for some sort of embedded scenario? Are these devices indicative of a particular market or user base that you're trying to address where Linux is particularly important? Do you expect to have a significant user base running your apps on Linux or is this more about being able to say that can run on Linux even though you don't expect significant usage? The more details you can share on the specific hardware and target audience the better. Thanks!

Professionally, we would consider deploying our already-existing Blazor WASM as a standalone application on cheap Linux-based ARM devices (IE Raspberry Pi or the like). Performance is paramount here as the application handles realtime data, and it tends to struggle in the browser on the lower power devices.

In my personal life I'd use it for many projects. Off the top of my head would be to support a Blazor Maui app I wrote to manage/monitor the power electronics on a Tesla-powered go cart I built. Currently I must use an android device, but this would allow me to use a Raspberry Pi instead.

I'd also do something similar with the cars I build, where I could read metrics from their ECU over CAN bus to monitor various metrics. Would be particularly helpful on an EV build I'm considering doing.

@kant2002
Copy link

kant2002 commented Jan 19, 2023

While MAUI does not support this scenario, maybe Photino will work for embedding space. It support both NativeAOT and Blazor which maybe help for mentioned scenarios.

@charleypeng
Copy link

While MAUI does not support this scenario, maybe Photino will work for embedding space. It support both NativeAOT and Blazor which maybe help for mentioned scenarios.

wow. this is great! works on my linux using photino.blazor this one is cool, i have to see how they implement for blazor. thanks

@juepiezhongren
Copy link

juepiezhongren commented Feb 4, 2023

as cat is without jit mode, appkit is also requried, also.

@lytico
Copy link
Contributor

lytico commented Sep 20, 2023

i am working on an implementation same like those: WinForms / WPF:

jsuarezruiz#62

current state:
Peek 2023-09-14 03-51

example with same code as this

@densen2014

This comment has been minimized.

@lytico
Copy link
Contributor

lytico commented Sep 21, 2023

@densen2014 what exactly is the purpose of your post? Do you want to say there is no need to implement that in MAUI cause BlazorHybrid.Linux is the better alternative? I thought this issue is about implementing a BlazorWebView in Maui, like Microsoft.AspNetCore.Components.WebView.WindowsForms, supported by Microsoft, and provided in this Project.

@densen2014

This comment has been minimized.

@lytico
Copy link
Contributor

lytico commented Sep 22, 2023

@densen2014 as far as i can read, this topic is about supporting Blazor in Maui on Linux, and not about "if someone want to try this or that or those". BTW, you already told us that you use SpiderEye in a post above, and that you are happy with it.

@lytico
Copy link
Contributor

lytico commented Sep 22, 2023

@danroth27 are you interested on a PR implementing Blazor Hybrid support for Linux separately from .NET MAUI support for Linux?
This would be an implementation same like those: Microsoft.AspNetCore.Components.WebView.WindowsForms / Microsoft.AspNetCore.Components.WebView.Wpf.

I could extract it from this PR:
jsuarezruiz#62

@danroth27
Copy link
Member

@lytico Thank you for offering this contribution, but we intentionally rely on .NET MAUI for our cross-platform host. We're not setup to maintain our own Linux based host on the Blazor team. But we welcome any community effort to maintain a Linux host for Blazor as a separate community driven project.

@charleypeng
Copy link

lol microsoft love linux , what a joke

@tthiery
Copy link

tthiery commented Sep 22, 2023

@danroth27 I appreciate the clarity. We as a community of users are in a space were we need to select a product vs alternatives like Flutter. And while Linux is not a huge market, this push decisions away from .NET, for rationales of product constraints but also when developers love Linux machines.

I hope this is a funding based decisions and not a fundamental disbelieve in the Linux use case or, even worse, a strategic pro Windows decision.

@Laftek
Copy link

Laftek commented Sep 22, 2023

@densen2014 thank for the pointing out such an alternative

@danroth27 we completely understand but waiting for MAUI is also not the answer. Blazor is doing really good, after united project and then later multithreading (.NET 9) it will do even better but still linux part is missing. It would be great to see at least some experimental attempt from your team. I know there are no resources but your team knows the technology behind blazor best and I think they would find also best option for blazor to be able deliver on linux.

@danroth27
Copy link
Member

I hope this is a funding based decisions and not a fundamental disbelieve in the Linux use case or, even worse, a strategic pro Windows decision.

@tthiery This is entirely a funding-based decision. I'm strongly supportive of supporting Linux. We already support Linux for server scenarios and multiple non-Windows platforms on the client. But with .NET MAUI we first need to address the issues we have with the existing platforms that we support before expanding to more platforms. On the Blazor team we are similarly stretched with handling our existing frontend web development scenarios. Stretching ourselves further on either front risks significant quality issues that no one wants.

@osnipezzini
Copy link

I hope this is a funding based decisions and not a fundamental disbelieve in the Linux use case or, even worse, a strategic pro Windows decision.

@tthiery This is entirely a funding-based decision. I'm strongly supportive of supporting Linux. We already support Linux for server scenarios and multiple non-Windows platforms on the client. But with .NET MAUI we first need to address the issues we have with the existing platforms that we support before expanding to more platforms. On the Blazor team we are similarly stretched with handling our existing frontend web development scenarios. Stretching ourselves further on either front risks significant quality issues that no one wants.

More and more baseless excuses. No software is 100% complete.

Not once did you ask for community support, as were the requests for Linux (Ubuntu) support. A Linux support fork was created by a user and it has been more than 1 year and nothing from Microsoft has supported the project or even incorporated it into the main project.

Why didn't Microsoft already support the community 100% when MAUI wasn't even released yet? Because they didn't give all the support and support we needed to build at least the Linux base and the community could help with the controls.

@CommonLoon102
Copy link

CommonLoon102 commented Oct 5, 2023

Forgive me that I haven't done my research on this, so maybe a stupid question.

Wouldn't it be possible to have @lytico 's solution on top of the official .NET package? Obviously, it would be needed to maintain it constantly to be compatible with MS's base DLLs. Linux users would install the official .NET 8 the official way, then from a ppa repo install lytico's extensions or have it as a drop-in extension with the application (self-contained publish) (maybe even by overwriting some of MS's DLLs, or patching some of them via reflection or something). Sounds kind of a hacky solution, but if it works, that's all we can do.

@mhrastegari
Copy link

Can't it be community maintained just like Xamarin.Forms?

@janseris
Copy link

janseris commented Oct 5, 2023

Can't it be community maintained just like Xamarin.Forms?

You mean dead?
Community maintained is just a corporate buzzword which means "we won't pay for it and allocate developers anymore".

@hifron
Copy link

hifron commented Oct 21, 2023

so we'd far prefer to run the .NET business logic code natively on the device instead of running that on WASM.

Problem maybe is that modern computers(among browsers) could have incorporated wasm stack and then download size could be not so big(like there is growing support for libwebkit even by Microsoft). Today's browsers are mostly based on blink/webkit stack and there is no built in support for non-HTML languages, but adoption of WASM are headed into this area although DOM browser understanding of objects are archaic. WASM is more low level and lower is only browser or operating system.

If there is DOM interface with blink/webkit interpretation, it is plugin for DOM coded in blink/webkit. If there is business logic coded in .NET and compiled for WASM, but intended for some platform for better platform goodies, directly compiling via Visual Studio something is question because there is already a lot of support for something in VS...

If Microsoft approach or something also related like JetBrains or Idea special code support could bring some more efficient programmers approach for code development(because lengthy and talkative Visual Studio code development is disaster by some way), then it could bring more summer light for question in the original Issue of this topic, but probably also a specialized development when something more corporative is needed and JetBrains, Idea or even Visual Studio is not so helpful 👯

There is already a lot of Visual, Programmatic and Other extensions in VSCode, but more functional Visual Studio with (some) paid plugins is not so related with its VSCode with broader(but lighter) ecosystem and today's need of programmers for things like JavaScript or npm also lead to a lot of plugins for VSCode, but paid extension in Visual Studio are not among them when there are some nice compilation something in npm world which won't led for Visual Studio environmental development for efficient code writing by Programmers when there are hundreds thousands of projects in big corporations like Microsoft or Google, but paid plugins in VS, VSCode, Idea for something which could paid development costs for something like compiler development, but also for some architectonical changes when big corporations are making their own hardware because normal hardware vendors have troubles with themselves is also a mark of problems with such Visual Studio plugins...

@ivanjx
Copy link

ivanjx commented Nov 22, 2023

maybe when ms says community support on linux they meant something like photino.blazor and thats it. at least there is something that works today.

@Eilon Eilon removed this from the Backlog milestone Dec 15, 2023
@danroth27 danroth27 added this to the Backlog milestone Apr 1, 2024
@veler
Copy link

veler commented Jun 13, 2024

Hi,
I'm the co-author of an app called DevToys (https://devtoys.app/). We recently released a new version made with Blazor Hybrid that targets Windows, MacOS and Linux.

To achieve it on Linux, we forked the .NET MAUI's BlazorWebView from Mac Catalyst, and rewrote it using GTK. It took me about 3 evenings to do so (doing this project in my spare time). It's not perfect, but it works!

Some challenges I got was having to dive into how to handle the clipboard myself, move and resize the window programmatically.
Another aspect of my fork is that it doesn't relies on .NET MAUI at all. I didn't try to fork .NET MAUI myself. That would have probably be too much work for my own person. So I just extracted the minimum needed to make it work.

Here is the Linux-specific code of this app: https://github.com/DevToys-app/DevToys/tree/main/src/app/dev/platforms/desktop/DevToys.Linux

More specifically:

  1. The BlazorWebView
  2. Reading and writing into the clipboard.
  3. Getting fonts installed on the OS.
  4. Reacting to the theme changes.
  5. Reacting to some window events.
  6. Finally, here is the GTK wrapper library I used: https://github.com/gircore/gir.core

I'm hoping this can help anyone trying to target Linux while there's no official support on MAUI.

@CommonLoon102
Copy link

I think this is doing the same as above:
https://github.com/JinShil/BlazorWebView

@ygl-rg
Copy link

ygl-rg commented Aug 1, 2024

Hi, I'm the co-author of an app called DevToys (https://devtoys.app/). We recently released a new version made with Blazor Hybrid that targets Windows, MacOS and Linux.

To achieve it on Linux, we forked the .NET MAUI's BlazorWebView from Mac Catalyst, and rewrote it using GTK. It took me about 3 evenings to do so (doing this project in my spare time). It's not perfect, but it works!

Some challenges I got was having to dive into how to handle the clipboard myself, move and resize the window programmatically. Another aspect of my fork is that it doesn't relies on .NET MAUI at all. I didn't try to fork .NET MAUI myself. That would have probably be too much work for my own person. So I just extracted the minimum needed to make it work.

Here is the Linux-specific code of this app: https://github.com/DevToys-app/DevToys/tree/main/src/app/dev/platforms/desktop/DevToys.Linux

More specifically:

  1. The BlazorWebView
  2. Reading and writing into the clipboard.
  3. Getting fonts installed on the OS.
  4. Reacting to the theme changes.
  5. Reacting to some window events.
  6. Finally, here is the GTK wrapper library I used: https://github.com/gircore/gir.core

I'm hoping this can help anyone trying to target Linux while there's no official support on MAUI.

thx veler.. your code is very useful.

@mkArtakMSFT mkArtakMSFT modified the milestones: Backlog, .NET 9 Planning Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Blazor Hybrid / Desktop, BlazorWebView platform/linux 🐧 proposal/open t/enhancement ☀️ New feature or request
Projects
None yet
Development

No branches or pull requests