Publishing Your .NET MAUI Apps | .NET Conf: Focus on MAUI

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[MUSIC] >> Thank you so much for joining this session on getting your apps ready. My name is Olia Gavrysh. I am PM on.NET Team focusing on. NET Desktop and MAUI. In this session, I will tell you how to deploy and publish your applications for different platforms. So.NET MAUI and that stands for Multi-platform App UI, and that it is supported on multiple platforms. To be specific, it supports Android 5.0 API 21 and higher, you can build apps for iOS 10 and higher. macOS 10.15 or higher, using MAC Catalyst and Windows 11. You can also run MAUI apps on Windows 10 version 1809 or higher with WinUI 3. But I always recommend to update to the latest Windows 11 to benefit from all the latest features and great design. You probably have heard about Hybrid Web Desktop applications with.NET MAUI Blazor. That one is a little bit more strict regarding the platforms that it supports. It requires Android 7.0 where API 24 and higher iOS 14 higher, macOS 11 or higher, and same for Windows. That's the work that we do here at Microsoft to distribute MAUI to different platforms, but also we have help from open source community that supports Linux on MAUI and also Samsung supports MAUI for their platform Tizen. But we will talk about Android, Windows, macOS, and iOS. When you are ready with your app, when you put all the amazing functionality and now you want to run it on different devices, see if everything works properly, debug, make final tunes, there are two things you want to do. First, you want to deploy your application to the device. That's what we refer to as deployment. It's easy for a desktop, Mac or Windows. You just run your app from Visual Studio or Visual Studio for Mac, and it's right there on your device. But when you want to test your app on mobile device, you either have to plug in your mobile physical device, or you can use simulator or emulator. I'll show you how you can do it from Visual Studio. It's extremely simple. For distribution, we will talk about how you can distribute your apps stores. It's Google Play Store, Microsoft Store, Mac App Store, and also you can decide Lloyd in or Ad Hoc. Let's start with Android alphabetically. When you want to run your application on Android device, if you are going to use emulator, do not forget to enable hardware acceleration Hyper-V. Otherwise, everything is going to be super slow. To do that in your Windows feature, check Hyper-V, check everything underneath, and also check Windows Hypervisor Platform. Also, if you have any issues, we have great documentation on that or I will be referring to these docs a lot today. It's docs.Microsoft.com/dotnet/maui, and here you can see get started. Here's the publishing section in Get started. For Android emulator, we have a great page on troubleshooting. If you're facing any issues like MMIO access error, missing Google Play Service, performance issues, hardware acceleration issues, look here, most likely you will find the solution for the problem. If you are deploying your application to the real device, do not forget to enable developer mode. We also have a description how to do that here in our docs enabled developer mode. You go to Settings, you select About Phone and you tap Build Numbers seven times until you see you are now a developer. Also, do not forget to enable USB Debugging on the device. If computer does not recognize the device, that happens sometimes, few fixes, you can install a driver for the device or installed the Google USB Driver through the Android SDK Manager, and also look at the documentation. We have some solutions documented there. Let me show you Android Device Manager that comes with MAUI when you install this Workload and Visual Studio. Here, enter a Device Manager. I can have different emulators for different devices. Let me add a new one. I can choose based device and there is a variety of what I can choose from. There's TV Generic, there's Pixels, all generations of Pixels, Nexus, Galaxy, etc. I can choose which OS I want on this device, and I can also find tune each property. I already have two devices. I have Pixel 5, I have Android Emulator. I can check and run it. One device is running already. I think that's Android Emulator. Let me show it to you now. This is how it looks. You can turn off the phone or on there is a sound volume. I can rotate, layout. I can actually navigate through device. That's super handy when you don't have the real devices, and you can just run the app, see how it looks like on the mobile. Let me run my app on this device. I have.NET podcasts. That's the aggregator for all the.NET shows that we have and you can listen to them from my application. I'm going to choose Android Emulator. By the way here, to my devices, I can add a new one for that I go to Android Device Manager add a new device, and I'll see it here. Definitely Android and let me run my app. >> While the app is running, because that might take some time. I'll tell you more about what else you can do and then hopefully we will see the application. Once my app is on the device and I debugged it, I'm happy with it. I want to distribute it to my end-users and I can publish and draw it through the store and as a sideloading, I can publish Android from CLI or from Visual Studio. First let me talk through the process like what are the steps for publishing and show you how you can do it from CLI and then we will do it from Visual Studio together. Three steps. First, you need to create the KeyStore file. That is the certificate that will help you to sign your application. Because if your application is not signed, you wouldn't be able to install it. Security reasons, very important. To create a KeyStore file, you can use a Keytool. From CLI navigate to a folder of your project and run Keytool junkie, like this script. Here, specify the name for KeyStore and just my App Store, LES and just set key. This is the algorithm encryption, RSA. This is the number of bytes used for encryption Standard 2048. Validity, how many days till your certificate will expire, 10,000, that's about 30 years. Android has no problem with you creating a very long lasting certificates unlike iOS. When you run this command, you will be prompted to enter password for KeyPass for StorePass. You enter all the data and you will get your KeyStore file. Once you've got it, you need to reference this file in your project seconds. For that, right-click on project edit. Find the section properties and group with target framework that contains Android. If it's not there, just add it. I prefer to add configuration release because if you're not building for released, we don't even look at those parameters. Then beside enter KeyStore to true Android sign-in KeyStore to this name that I specified on the past on the step above. Alias, also what I provided right before it and their parameters and draw its sign and keep us and during sign-in store paths, that's the passwords that I just entered on the previous step. If you're doing it from CLI, I recommend to not store passwords in your Config file, but rather enter them as parameters when you are publishing. The third step, just publish for that also from CLI, navigate to the folder of your project and run.Net Publish was a framework.net6.0-android. That's the framework that you are targeting. If you're targeting.net7.0, then it's.net7.0 configuration really so debug and here are your parameters. The password for sign-in KeyPass, and the password for StorePass. As a result, in the been released.net6.0- android publish folder, you will have ABB and APK files that you can take and you can either upload it to the App Store, Play Store, or you can side-load them. Let's go back to my Visual Studio. Actually, let's try. Anyway, I will be able to show you this application later in the demo for iOS. Now let's talk about publishing. For publishing from CLI very easy, from Visual Studio, even easier on your project. right click Published makes sure that here you are selecting Android one of your android configurations. Right-click Publish. That triggers publishing for Android. As you can see, the processes happening but they are already published it a few times before with different devices, different configurations. Once this is done, you will see buttons distribute, open distribution of open folder. Then open folder, I will see my package AB bundle. When I click on distribute, I have two options. I can do at home or you can do Google Play. If I do at home. Here, I need to specify the sign-in KeyStore. That's exactly the same thing that we were creating the CLI before. Here I can create it from UI. I provide LAS password, some information, click "Create" and that's how I get the KeyStore file. I already have one, so I'm going to choose this one and since I chose at HOK, that will create the sign bundle for me. I'm going to click "Save As", you could say folder. And that's where enter the password. That's the same password that I provided when I was creating the certificate and once this is done, I will see the bottom open distribution for this one I already see, or for this one for that matter. Once we go here, here's my ABB file that I can take and I can upload it to Play Store or I can do sideloading. If I want APK in my right-click settings, I can specify what kind of package I want to do, either APK or AB for release and for debug so I can change it to APK. Now, as for iOS the process is very similar and you can also do many things from Visual Studio. But you will need a little bit more preparation for sign-in and you will need your Mac machine. For distributing application to iOS, you need to create Apple ID. You can do that Apple id.apple.com/accounts. You need to enroll into Apple ID. You need to enroll your Apple ID in the Apple Developer Program and for that you need to pay money and every year you need to renew your membership. Then you need to prepare a Mac machine. You can do things from Windows mission, but you need to connect to your remote Mac machine. Then to publish from CLI, first of all, I don't have time to show you how everything is done, but we have great documentation that you can show that describe step-by-step and very briefly, I'll just describe the process here. In your developerapple.com. You need to create from the UI. You need to create a certificate signing requests. Then distribution, distribution certificate, distribution profile in your Apple Developer account. Then you need to download provisioning profile on your Mac, similar to how we work, gave him the KeyStore files for Android. Then if you need, you can add entitlements to your project. You can do code sign and data to your up project. You are connecting Visual Studio to Mac build host and then you write this.NET CLI command and yeah, I know that's a lot, that looks like a lot. But just go to docsMicrosoft.com/net/maui/ios/deployment/overview and their step-by-step, everything is explained. If you have any questions, feel free to reach out to us on Twitter. In the Visual Studio, report feedback or report issue just in any through e-mails. Just feel free to ask us any questions. We're happy to unblock you and help you with your.NET more adventures. One thing I put the reminder here, certificates are expiring in one year, unlike Android where we created it for 30 years. Here every year you need to repeat this process. >> For macOS, everything is pretty simple. In terminal, since you already have the device, your Mac machine, where you're going to deploy. When you do.NET build, it creates.APP or.PKG files that you can then upload to Macstore. To do that in terminal, navigate to the project that you want to publish, and do.NET build specified framework..NET 6.0 maccatalyst or.NET 7 if you are using.NET 7. Specify configuration release or a debug, and by default it will create.app file. If you want.PKG, you need to set "Create package to true. Just add the parameter, create package to true. We start. Let's go to publishing on Windows, and try everything from visual studio. I'm going to close this one, and I'm going to change this to Windows machine. First of all, let me run the application, and see how that looks on Windows. I think I can close all this. Let's continue debugging. It complains because I'm doing a release. Of course, if I wanted to debug, I will change it to debug. But here this, here's our podcast application, and here we can choose different shows. Let's see.NET Rocks, and for example, this one. It can play shows. Again, I think I'm not producing the sound, but that's where you here are amazing ,.NET 4 is talking about all the latest, greatest features. I have this app now. I want to publish it also two ways. You can do it from Visual Studio. You can do it from CLI. First, I'll show you visual Studio super easy. Right-click "Publish". Here I can choose "Microsoft Store" under "App name". Then I need to provide information for Microsoft Store. Or I can choose side loading. In side loading, there is an option to skip sign-in, but then your application won`t be installed unless it is signed. If you skip in sign-in, you need to sign it somehow manually after that. Or you can sign that in this wizard. For that, it already has my certificate that I created. I can remove it, and I create the new certificate. It's pretty trivial. It just like you're filling in fields. Let's give this to save some time. I can look at details for the certificate. That all looks fine. I can choose signing algorithm. I'm going to click "Next". Here. I can set publishing profile, and I can create a new one. I can choose configuration released or debug. I can choose the target runtime, so 86, 64, ARM of 64, I can just self-contained, are not self-contained. If I'm doing self-contained. Packages, libraries of.NET boys, my application, so my application becomes not dependent on the environment of my users. Of course, this size gets bigger, but then my users don't need to install anything on their machine. They get everything with the application, and I can specify package allocation. I already have bug engine profile, so I'm going to choose that, and I'm going to click "Next". Here I can set in style installer occasion, and it can be a URL, UNC path file, share location, whatever it is. I can choose how often my application can check for updates every time or every amount of days. Then I actually put it back. I could click create, and that's how my application is getting published. But instead of that, let me do it from CLI. From CLI, I just type in.NET, publish a specified the project because I have a few of them. I specified framework as we did before. Configuration. That's pretty much it. Just one line is going to publish my application, and store MSIX package on my machine. Let me awhile it is Iranian. Let me navigate to the folder. It's going to be my bin folder than release then.NET6 Windows 64 app packages. Just a few more minutes until this one is done. Then there you go. It says that it created in demo.NET podcasts that, this.MSIX package. Let me go find it. Let's not sure one, but here's MSIX package. Before I run it, let me make sure, I have application on my machine, so I'm going to uninstall it first. My machine is clean. Now, I take this MSX package and I distributed to my end users. Now I'm going to pretend the time my user, I'm going to double-click "Install". Here this my application installed on Windows machine. I can see it here. Yeah, let's make sure everything works. Here's a.NET Rocks and explain. That's how easy you can distribute your applications and everything is available from Visual Studio. If you prefer CLI, that also is ready for you. With that, that's all I had for today. I'm happy to answer to any of your questions. If you face any issues or if you have any suggestions, any feedback, please reach out to us via like, very thankful and very appreciate your ideas. Thank you.
Info
Channel: dotnet
Views: 14,481
Rating: undefined out of 5
Keywords: .NET
Id: COMB1QsbB1M
Channel Id: undefined
Length: 24min 15sec (1455 seconds)
Published: Wed Aug 10 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.