locked
Cross Platform + Web Application? RRS feed

  • Question

  • User315288 posted

    Is it possible to use Xamarin Forms to create a cross platform application that also produces a .NET web application? I want to do something simple like have a webpage with a database that users can add data to, on any platform, web, android or iOS. Thanks any advice in the matter would be greatly appreciated!

    Friday, April 7, 2017 4:21 AM

All replies

  • User315059 posted

    Building a mobile app that runs on more than one platform, with minimal code changes, is a technical Holy Grail. The HTML5 stack (using CSS and JavaScript, among other standards) and Java are two solutions. Another is Microsoft’s .NET plus C#, a combo that’s been overlooked outside the Windows Phone 7 developer community despite its potential to create apps that can run natively on Android and iOS. C# and .NET are both very mature and powerful technologies. They have evolved over the years to provide support for things like asynchronous programming and memory management, and features like LINQ help make them great to work with as a developer.

    For example, there is no garbage collector when writing iOS apps with Objective-C. That’s a feature .NET developers are used to having. MonoTouch actually brings a garbage collector along with it, making it much easier to work with, without having to worry about manual memory management.

    The addition of another layer between you and the platform will have its consequences, but by and large, it’s not something you’ll notice or need to worry about as a developer. Since MonoTouch applications are run through its ahead-of-time compiler, their performance is already highly optimized. Mono for Android applications include their own instance of the Mono runtime that .NET code is run against and includes an intelligent garbage collector that is optimized for managing objects across the different runtimes. In general, you won’t be able to see any difference in performance between an app written in C# and one that is not.

    The second part of the desktop/web development world is Microsoft’s .NET Framework. .NET1 is a software framework developed by Microsoft that runs primarily on Microsoft Windows. It includes a large library and provides language interoperability (each language can use code written in other languages) across several programming languages. Programs written for .NET Framework execute in a software environment known as Common Language Runtime (CLR), an application virtual machine that provides services such as security, memory management, and exception handling. The class library and the CLR together constitute the .NET Framework.

    Web applications for the .NET Framework are developed using ASP.NET, while native applications are developed using Windows Presentation Framework (WPF) and C#.

    ASP.NET is a server-side Web application framework designed for Web development to produce dynamic Web pages
    WPF is a computer-software graphical subsystem for rendering user interfaces in Windows-based applications
    C# is a multi-paradigm programming language encompassing strong typing, imperative, declarative, functional, generic, object-oriented (class-based) and component-oriented programming disciplines
    
    Monday, April 10, 2017 7:01 AM
  • User315288 posted

    That didn't address my question at all. You just stated what Xamarin is...

    Monday, April 10, 2017 1:26 PM
  • User322626 posted

    I too had a similar query - can anyone guide?

    Thursday, May 11, 2017 1:10 AM
  • User353108 posted

    Xamarin forms will not come for website development, for that you have ASP.NET

    Monday, November 20, 2017 9:41 AM
  • User364178 posted

    @avita said: Building a mobile app that runs on more than one platform, with minimal code changes, is a technical Holy Grail. The HTML5 stack (using CSS and JavaScript, among other standards) and Java are two solutions. Another is Microsoft’s .NET plus C#, a combo that’s been overlooked outside the Windows Phone 7 developer community despite its potential to create apps that can run natively on Android and iOS. @avita he already asked to use Xamain.Forms, he wants a compile target for client-side web browser. @"AlanJonesRios.4721" said: Xamarin forms will not come for website development, for that you have ASP.NET @"AlanJonesRios.4721" ASP.NET Forms is a server side technology, not at all what @n0cshuf is looking for. ASP.NET requires a post-back to the server to handle every event, is slow and clunky. A Web 1.0 tech.

    The Xamarin.Forms implementation for web would run everything client side just like a phone/tablet app would. This is mostly accomplished using JavaScript / HTML5. He (like me) wants a client side implementation of Xamarin.Forms which can run in a browser without having to write a whole second application in JavaScript + random JavaScript libraries.

    @n0cshuf here is my understanding - Ideally we could run .NET code in a browser with a translation layer to HTML5 controls with a full XAML compile to HTML5 / CSS done for us (similar to how Android/iOS/UWP native control mapping works). The catch is, having browsers support anything beyond Javascript traditionally requires plugins.

    The traditional plugin way to do this has been using the NPAPI to build a browser extension which all browsers support, examples of these include; Adobe Flash/Shockwave, Java, Silverlight and Unity. The problem with this approach is that NPAPI is really old, wasn't sandboxed, non-standard, etc. so all major browsers have eliminated NPAPI from their browsers this year. So something like Silverlight was an older way to run .NET and XAML directly in a browser, but it required the user to install a plugin. It didn't catch on so much.

    Enter WebAssembly! The new cross-browser supported standards based, native binary execution model. They don't need plugins installed, but have their binary files downloaded on the fly, and are run in a browser controlled security sandbox. It has support for C++ and C so far, so what about C# + .NET?

    The WebAssembly Mono Project is looking at exactly this. It is working in a proof of concept, but isn't nearly ready to be used. I would expect the next 12 months will be interesting to watch. If the mono project can deliver something, and especially if Microsoft/Xamarin team get involved they would potentially have this done rather quickly. Once mono for web is ready, then Xamarin would need to implement the native controls mapping and XAML support for web / HTML5 / CSS. So technically it is very possible to do, and will likely be here sooner rather than later, but not right now.

    Update: Microsoft are actively building out Blazor (project on GitHub) already which does exactly this.

    Saturday, December 30, 2017 2:31 PM
  • User271938 posted

    There's a recent open source project that implements a backend that allows Xamarin.Forms to run in a browser. It's called Ooui (pronounced "weeee"). You can find a description here. The GitHub repository is here.

    Friday, February 9, 2018 5:56 PM
  • User271938 posted

    Regarding Microsoft's Blazor experiment, to quote from a recent Microsoft blog, "it is not a way of deploying existing UWP or Xamarin mobile apps in the browser."

    Friday, February 9, 2018 6:19 PM
  • User209534 posted

    Sorry for the up !

    I actually managed to launch a Blazor application as an hosted Xamarin app, by embeding my Blazor app in a zip file (read in a the shared mobile project), and managing webview request through a embeded Http Server, actually Waher.Networking.Http.

    By mimicking results expected from a WebServer inside the app, Blazor is able to load, some polyfill may be needed and some additionnal security check as iOS still have somme issue with WebAssembly at the moment (but not with asm.js)

    Made it work on Android and iOS, it's very great! I think we may now have the opportunity to do Web and Mobile in C# , and also interoping within the mobile app in C#.

    What a .NET developer dream !

    Not able to launch the app from UWP, except with the local loobpack isolation disabled for debugging. There is surely some workaround, but that would need to change the Blazor code, wich is not straightforward nor interesting.

    Tuesday, May 1, 2018 10:35 PM
  • User381905 posted

    @Adam_Coulter said: ...Once mono for web is ready, then Xamarin would need to implement the native controls mapping and XAML support for web / HTML5 / CSS....

    That may be true, but all XAML needs to a GPU accelerated drawing surface from the underlying operating system. For the web, that could be a 2D Canvas. If not a canvas, it might be easier/more-efficient to manipulate an SVG. The DOM could certainly be controlled with HTML elements, but Canvas can even achieve 60 fps performance and consistent layout results.

    Tuesday, January 29, 2019 1:55 AM
  • User330867 posted

    @"GuillaumeZAHRA.5822" said: Sorry for the up !

    I actually managed to launch a Blazor application as an hosted Xamarin app, by embeding my Blazor app in a zip file (read in a the shared mobile project), and managing webview request through a embeded Http Server, actually Waher.Networking.Http.

    By mimicking results expected from a WebServer inside the app, Blazor is able to load, some polyfill may be needed and some additionnal security check as iOS still have somme issue with WebAssembly at the moment (but not with asm.js)

    Made it work on Android and iOS, it's very great! I think we may now have the opportunity to do Web and Mobile in C# , and also interoping within the mobile app in C#.

    What a .NET developer dream !

    Not able to launch the app from UWP, except with the local loobpack isolation disabled for debugging. There is surely some workaround, but that would need to change the Blazor code, wich is not straightforward nor interesting.

    Mind sharing the code please?

    Sunday, May 17, 2020 11:02 PM
  • User6682 posted

    @amirvenus said:

    @"GuillaumeZAHRA.5822" said: Sorry for the up !

    I actually managed to launch a Blazor application as an hosted Xamarin app, by embeding my Blazor app in a zip file (read in a the shared mobile project), and managing webview request through a embeded Http Server, actually Waher.Networking.Http.

    By mimicking results expected from a WebServer inside the app, Blazor is able to load, some polyfill may be needed and some additionnal security check as iOS still have somme issue with WebAssembly at the moment (but not with asm.js)

    Made it work on Android and iOS, it's very great! I think we may now have the opportunity to do Web and Mobile in C# , and also interoping within the mobile app in C#.

    What a .NET developer dream !

    Not able to launch the app from UWP, except with the local loobpack isolation disabled for debugging. There is surely some workaround, but that would need to change the Blazor code, wich is not straightforward nor interesting.

    Mind sharing the code please?

    A long time has passed since my initial post. Checkout my BlazorMobile project: https://github.com/Daddoon/BlazorMobile

    Monday, May 18, 2020 8:29 AM