-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Epic: Blazor developers can target and deploy their applications to desktop platforms, allowing them to run natively #2536
Comments
Are other platforms in play here as well? Like MBB's usage of iOS and Android to complete this story? Or maybe the inclusion of MBB into ASP.Net brings those and this epic fills the gap? |
I'm in the loop, One .NET! |
@Eilon !!! I for one welcome our One .Net overlords. For me, there's one big piece which brings Blazor together in a powerhouse .Net 6 release, but it's over on the Runtime team. @danroth27 can you throw your weight around to get this slotted between now and November? |
Is it something with MAUI? |
Thanks for contacting us. |
Hi! |
Hi @kristof12345 yes this is part of the plans for .NET 6! |
👀 |
With MAUI introducing support for the Android and iOS platforms, and since Blazor is built on top of MAUI, will Blazor support those platforms as well? |
@mrlife the main goal for .NET 6 is to support the Windows and macOS desktop platforms, but we will surely have code running on Android and iOS as well, but it might not be fully supported at that time. |
I hope that accessibility for impaired people (like blindness) will be accounted for so apps like these will be accessible from the start, or at least the examples will be. |
Is this available in the .NET 6 Preview 1? Thanks in advance. |
I want Blazor Desktop to also support automatically update themselves. like electron-updater. Idea : ElectronNET/Electron.NET#259 https://github.com/NetSparkleUpdater/NetSparkle cheers>> |
@LeonarddeR accessibility is certainly important for all apps so I'm adding that to the checklist of things to look into. |
@kmanev073 said:
It is not in Preview 1. We plan to have this in no later than Preview 4. |
@todosrc said:
Installation/deployment/update support is an interesting problem, and we are looking at various solutions to this, including using some of the ones you mention! |
Remember ClickOnce deployment? |
So, something to consider while you folks are looking into this. I'm building BurnRate.io, and we're in the process of moving a large OData/TypeScript/Webpack app to Blazor. When we add support for installing the app to the Desktop, we're still planning on shipping our Blazor WebAssembly version to the web, so people can access it where- and however they want. Up to this point, we had planned on doing that through Electron.NET. However, Electron's update infrastructure is less than awesome, and requires a lot to build multiplatform update binaries. This should be wholly unnecessary with Blazor. It would be great if the Blazor Desktop version could just download a manifest of MD5 hashes for the app files, and if any of them differ from what is installed, the app downloads them from the server-deployed version. That way, it's seamless for everyone, I know my customers will always be running the latest version, and you don't have to worry about trying to package MSI files or anything like that. If security is an issue, then the files could all be digitally signed on the server, to reduce the risk of tampering. I hope that real-world situation helps with your planning. We are a Microsoft for Startups / Microsoft Partner company, so if you have a TAP that would let us test this before the preview, would love to participate. Thanks so much! |
This would be totally awesome. My app (http://github.com/webreaper/damselfly) bundles the installers/zip for the desktop electron wrapper into the Docker images, and I've used some javascript interop between Electron and the server to determine if the current container matches the server that's providing its content. If not, the user is notified and can optionally download the DMG/zip/AppImage file from the server and upgrade. I'll probably implement one-click download/install at some point in the future. But it would be great if Blazor could provide all the scaffolding to do this automatically without me having to write the versioning management and server/desktop JS interop by hand. |
I think if Blazor Desktop is built on top of MAUI with WinUI3 which requires Win10 1809, then MSIX might be a good option as well. |
@rogihee My perfect world is somewhere very close to that too. I'd like to see WinUI 3 across all of MAUI including Web and all other platforms and that Blazor Desktop would just be a markup syntax for MAUI... |
So, would it not support Linux desktop platform? |
@Eilon is there a planned cadence for the preview releases? |
@shashank-shekhar - This is all part of .NET 6, so when the code is ready it will be in the next .NET 6 preview. We're hoping to get something into .NET 6 Preview 3, but no later than .NET 6 Preview 4. |
@lucifer-morning-star said:
Linux is not currently planned, but with .NET MAUI (much like Xamarin.Forms) it's conceivable that it could be added in the future. |
@Eilon said:
Damn, that's a deal breaker for us. Looks like we'll have to stick with Electron.NET for the foreseeable. |
@tub5 have a look at Avalonia UI or Uno. |
@Kryptos-FR we looked at both previously but decided using Blazor with Electron.NET would suffice until the Blazor Desktop Applications came about. As our application is written using Blazor, when the ability is implemented, the migration should take a matter of days rather than weeks/months recreating the UI. |
So,
|
I believe Linux was only descoped from .Net 6 during their planning. I would imagine we'll see that re-scoped for .Net 7. You can see on this page the Feature still mentions Linux, but they removed it from the actual feature once you click on it. |
is there any guide on how to access the content inside wwwroot folder? i tried to use httpclient but it gives me empty base uri error. tried to set the base to 0.0.0.0 but it says the address is not a routable address. thanks. |
I think you would need to use regular |
@realivanjx it depends on where you're trying to read it from. If you're just trying to use it within the web view (e.g. for CSS, images, etc.) you can reference it directly from HTML content, for example, |
@realivanjx If you are hosting your web on a server, you can always access it with relative or absolute (https://(your server's domain)/(your file)) url, within the app, adding '/' first means you are navigating from the root |
yes it works if i use it directly on the html or razor components such as img etc. what im looking at is like the weather forecast example but running it with blazor desktop. something like this in the default project template's
|
@realivanjx in that case I would read the file directly. In Preview 5 it's a bit awkward to read it directly and that's something we aim to fix in an upcoming milestone using a feature called MauiAssets. You'll be able to use a simple API to read these files directly without trying to use HTTP (which doesn't really make sense in a desktop app). Another thing to keep in mind is to make this more platform-independent (such as Blazor Desktop and also Blazor WebAssembly and Blazor Server), you might want to introduce a custom service in the Dependency Injection (DI) container, such as IForecastLoader, for which you have a different implementation on each platform. In Blazor Desktop it could use MauiAssets, on Blazor WebAssembly it could use HttpClient, and on Blazor Server maybe HttpClient or something else. |
For Blazor server, presumably, the best option would be to use UseStaticFiles? I use this in my project and it works very well.
You'd then call something like
I haven't tried Maui or Blazor desktop yet, so can't comment on that side of things. |
I don't see this in VS 2020 17.0.0 Preview 2 - has this feature not been shipped yet or am I missing something ? |
Hi @shashank-shekhar. This work is happening as part of .NET 6. The .NET MAUI Blazor app templates don't show up in VS2022 yet, but they will in an upcoming VS2022 preview update. |
is there any way to hide or package the wwwroot files inside the app's exe or app data folder so the end user wont easily modify those files? thanks. |
@realivanjx that's not something that we have planned in the initial release. |
Presumably if this was really important, you could embed the files in blob or (encrypted) zip file, and then use a controller as a facade in front of those files, which would extract the files on-demand as required at runtime. Messy, but would probably work? |
The question that comes up when people ask about embedding files is: what are you trying to protect? Ultimately there's a WebView in there that people can "sniff" into in various ways. There should be no genuine security concerns because there is no trust at that level. Users can't modify application files if they're not admins, and if they are admins, or it's locally installed, they can see/modify whatever they want and you can't prevent that no matter how hard you try. I think some developers want to prevent users from casually seeing or modifying app files (that is, without much effort). My personal view is that that's somewhat pointless because why bother, but certainly others have a different view on that. We might at some point offer ways to make it easier to embed the files, but to be clear, it offers no additional security in a trust boundary. It only adds obscurity/obfuscation. |
in my case i dont really seek security that much. this is just matter of tidiness since the app is portable one. for now i managed to make everything into single exe file but the wwwroot folder. |
@realivanjx can't you wrap it in an installer? |
I have also requested this feature in the MBB repo, dotnet/MobileBlazorBindings#332 I prefer not to use installers as they are complicated and not needed for single file executables. Many modern projects simply ship a single exe per platform. |
It sounds like what you're referring to is a properly compiled single-file executable for .Net apps, which doesn't self-extract to a temp location at startup but is actually a single compiled binary - ideally with the wwwroot etc type non-binary files embedded as some sort of resource. My understanding is that there's a separate issue in the .Net runtime to try and achieve this (I've got it bookmarked somewhere but can't find the link...). |
The current implementation does not let us configure the file provider it uses. I filed the issue #1349 but there hasn't been much activity on it so far. |
@Eilon what's the status of Linux desktop support for Blazor hybrid apps? I understand that MAUI is used to some extent, and MAUI does not support Linux. |
I found a related repository: https://github.com/jsuarezruiz/maui-linux |
Linux support is not in the plans for the current release, but it's certainly something we're thinking about. There have been a few issues logged on this before: https://github.com/dotnet/maui/issues?q=label%3A%22platform%2Flinux+%F0%9F%90%A7%22+ |
Closing this because most of this works by now, and everything else should be tracked with various bugs marked as |
Summary
In .NET 6 we want to extend Blazor's target scenarios to include native desktop applications via web-based rendering.
User Stories
User Stories under this Epic:
The text was updated successfully, but these errors were encountered: