dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.22k stars 9.95k forks source link

Enable Ability to Host Blazor Applications in Microsoft, Apple, and Google Play Stores #11082

Closed Mike-E-angelo closed 2 years ago

Mike-E-angelo commented 5 years ago

Is your feature request related to a problem? Please describe.

As a developer and software business owner, I want to reduce development costs by having to develop and maintain one source of code and be able to deploy it to any hosted environment.

Currently, Blazor achieves a great deal of this by allowing deployment as a website.

However, there are three other significant environments to consider:

Describe the solution you'd like

This idea is based on a conversation started over four years ago. The idea started to seem possible when Ooui was circa late 2017. From there, I myself was able to run a test with Ooui on a local development Windows store test application, and it appeared to work. However, I never did get to deploy to the Windows Store for definitive confirmation as I do not have a developer license and preferred someone who had a license to try it out to how it fared. Unfortunately, this never happened.

But now that we have all of MSFT behind this innovative approach in Blazor, ๐Ÿ˜ I am sure we can find the resources to adequately attempt and confirm if this is possible -- and if not, perhaps make adjustments accordingly so that it is possible in a future version.

To be certain, the requested solution is:

  1. Host an ASP.NET Core server locally within a store-hosted application context, much like (or exactly) the same way it is hosted within a WebAssembly application context.
  2. Utilize a WebView or equivalent control, defined as the primary (or only) control within the application so that it displays web pages.
  3. From the WebView control, make requests to the web server established in the first step.

Describe alternatives you've considered

As mentioned, web deployments are very effective as all store-enabled devices listed above have a modern browser installed that support them. Additionally, with the advent of Progressive Web Applications, the case can be made that store-hosted scenarios are a dying concept or at least becoming passรฉ.

However, having the ability for native store hosting only strengthens the Blazor brand and allows for confident recommendations knowing that all major hosted environments are covered. I for one would like knowing that I can achieve store-hosted scenarios for recommendations with my own clients, as well as having it in my back pocket if the requirement should arise.

Finally, having this capability would provide a potential resolution to one of the most requested ideas in .NET's history.

Additional context

I believe I have covered all aspects with links in the above description. Thank you for any consideration around this goal!

GearTheWorld commented 5 years ago

I support the idea.

Don't forget to give us a DESIGNER as this accelerates development event more ! Lately I had to design a form in which it took me a very long time of F5, looking, adjust the text base UI development aka html/js and go back and forth like this a very fair amount of time. This is completely unacceptable these days.

I see no reason to not having a designer capable of knowing the model and simulating it.

Mike-E-angelo commented 5 years ago

Ask and you shall receive, @GearTheWorld. ๐Ÿ˜†

https://www.radzen.com/blog/introducing-the-blazor-wysiwyg-design-time/

danroth27 commented 5 years ago

I think there are a few things we can consider doing here:

AdmiralSnyder commented 5 years ago

@GearTheWorld I built a edit-and-continue like environment using dotnet watch and some VS Detach/Attach stuff, so I can just edit my .razor files, save and wait 2-3 seconds to get the browser refreshed.

danroth27 commented 5 years ago

@AdmiralSnyder @GearTheWorld Hopefully with the new Preview 6 release and the latest VS Preview update you should now also get that edit-save-refresh experience in VS without any additional work. We also have adding support for live reload on our backlog (#5456).

MatthewS2077 commented 5 years ago

Blazor PWA gets my vote. I'm interested in client side Blazer so anything that decreases the startup time and initial payload is welcome.

danroth27 commented 5 years ago

Thanks @MatthewS2077! Supporting PWAs with Blazor is something we've had on our backlog to do for a while. First step is to ship the WebAssembly support of course :smile:. Also, to be clear, the options above are not mutually exclusive. We could do none, some, or all of them.

Mike-E-angelo commented 5 years ago

Thank you for being so engaging and providing so much dynamic input @danroth27. I'm feeling the love here. ๐Ÿ˜

I think PWAs are a natural first step as that is closely aligned with the capability/intent of HTML5 as well as hosted stores. As an aside, I'm also shocked that hosted stores allow PWAs as it would seem that PWAs are basically meant to circumvent the stores altogether. ๐Ÿคทโ€โ™‚๏ธ

The hybrid approach that you mention seems valuable as well. I especially <3 your comment in regards to it running directly in Xamarin. I have been wondering if that is the case, or if there was some integration involved, so good to know this.

Native seems great, too. ALL OF THE ABOVE. ๐Ÿ˜† Hopefully, we can get the resources to flesh this all out in earnest and make it a legitimate competitive offering in a future version. ๐Ÿ‘

jzabroski commented 5 years ago

@danroth27 , you can target Cordova with Blazor today with some hacks. The pain would be in debugging tooling.

stavroskasidis commented 5 years ago

@danroth27 The cool thing is that theoretically these projects (Blazor Hybrid/Blazor Native) could be started immediatelly since they probably would be based on Xamarin which is stable and mature. I really think you guys should push the higher-ups to invest in these projects to start working on them asap. This is a unique opportunity for the .net ecosystem.

simonziegler commented 5 years ago

I'd like to add my weight (such as it is!) to this thread. I hope later this year to hire a team to develop a SaaS product based on Blazor. My dream would be for the web app to be based on AOT compiled client side Blazor (interpreted is way too slow for my computational work load), and to wrap this up as a PWA to provide offline fallback when the internet connection goes down. It feels like this is all on your radar and somehow in progress, however the sooner the better!

Many thanks for the ongoing great work with Blazor

menasheh commented 5 years ago

Really excited about most of these ideas, although unfortunately they seem to be 2-3 years away at least

Mike-E-angelo commented 4 years ago

Relevant: https://youtu.be/6BT2AF9PO5g?t=3362

Would be nice to see a web equivalent to this. For instance, upon compiling for a web site/context, StackLayout would get converted to a <div /> with necessary CSS to make it operate just the same as it does in the mobile/native context, only in a web page, instead. :)

/cc @SteveSandersonMS / @danroth27

Mike-E-angelo commented 4 years ago

For instance, upon compiling for a web site/context, StackLayout would get converted to a

with necessary CSS to make it operate just the same as it does in the mobile/native context, only in a web page, instead

BTW, this is exactly what Uno does with their magic: https://medius.studios.ms/Embed/Video-nc/B19-CFS2009?latestplayer=true&l=2476.0675

So, it would seem that there is a battle brewing between Blazor and Uno to capture this market, and I'm... ok with this. ๐Ÿ˜

paolofulgoni commented 4 years ago

@danroth27 is Blazor Hybrid tracked by any issue? How can people show interest in it?

danroth27 commented 4 years ago

@paolofulgoni Great question! I've created https://github.com/dotnet/aspnetcore/issues/18670 to track Blazor Hybrid related scenarios.

scottkuhl commented 4 years ago

https://github.com/dotnet/aspnetcore/issues/11082#issuecomment-505223600

@jzabroski Do you have any examples or can you point me in the direction of getting Blazor working on Cordova?

Mike-E-angelo commented 3 years ago

GETTING WARMER. :) :) :)

https://devblogs.microsoft.com/aspnet/unified-ui-mobile-blazor-bindings-preview-5/

Eilon commented 3 years ago

I mentioned in the blog post, but worth mentioning here as well:

There is in fact one app in the Apple App Store that is built using Mobile Blazor Bindings: a recipe app that I built: https://github.com/Eilon/Rezipe . At this time itโ€™s native only and not hybrid, but I plan to add hybrid features to it as well. Install on iPhone/iPad from here: https://apps.apple.com/us/app/rezipe/id1529670338

danroth27 commented 3 years ago

There is in fact one app in the Apple App Store that is built using Mobile Blazor Bindings: a recipe app that I built

It's like the first pebble kicked loose at the top of a mountain! ๐Ÿ˜„

HasinduLanka commented 3 years ago

I wanted the same thing, so we built an android app to load the Web App into a Web View and handle client-side storage, Show Ads, and run native android commands.

We first tried Xamarine, but we were unable to get google ads working on it. So this is an Android Studio project. Now it's in production on Sithiyam Ruwa app on playstore and a few other projects.

I removed most of our mess and made a clean solution, just for you guys. It's super lightweight. This template loads a simple PWA game.

https://github.com/HasinduLanka/BlazorDroid

simonziegler commented 3 years ago

@danroth27 - don't tease by not telling us the name of the app. I need to try your recipes out. I promise only to leave friendly comments! Seriously though, I'd love to see this in action.

Eilon commented 3 years ago

@simonziegler the info is in my post above @danroth27 's comment:

recipe app that I built: https://github.com/Eilon/Rezipe . At this time itโ€™s native only and not hybrid, but I plan to add hybrid features to it as well. Install on iPhone/iPad from here: https://apps.apple.com/us/app/rezipe/id1529670338

The source is on GitHub, the Apple App Store link is there! Enjoy ๐Ÿ˜„

simonziegler commented 3 years ago

@Eilon thanks - I'm looking forward to seeing where you folks have reached. Having a single platform to support any kind of app I can reasonably conceive is exciting!

RChrisCoble commented 3 years ago

I think there are a few things we can consider doing here:

  • Blazor PWA - Make it simple to build Blazor progressive web apps that support offline scenarios and native integration where possible. Tracked by #5479. These apps can be installed via most app stores.
  • Blazor Hybrid - Run Blazor on mobile devices that then drives a WebView. This is very similar to how our Blazor Electron prototype works today and sounds closest to what is being proposed here. I believe it's also similar to how Cordova/Ionic based apps work today and would share similar trade offs (convenient to reuse web skills and code, platform agnostic UI code, tricky to make feel truly native)

    Note that the Blazor code does not need to run on WebAssembly - it could run directly on the device like Xamarin apps do today.

  • Blazor Native - Run Blazor on a device using an appropriate .NET runtime (.NET Core on Win/macOS/Linux, Mono on mobile, .NET 5 in the future) and integrate with the native components of the platform. This is similar to how React Native works today.

Vote for "Blazor Native" for this UC, to maximize performance on the target devices.

danroth27 commented 2 years ago

We are supporting hosting Blazor components in .NET MAUI apps, which can then be deployed to app stores. This work is being tracked by https://github.com/dotnet/maui/issues/2536.