What was that command again? To
archive my .NET MAUI app so I can publish it to the App Store. Is that something
that looks familiar? Then keep on watching this video, because I'm going
to show you an amazing VS Code extension that will help you to archive and
publish your .NET MAUI app to the stores. In an earlier video, I've already
talked about the. .NET MAUI VS Code extension which allows you to develop your .NET
MAUI app straight from Visual Studio Code on Windows, macOS, even on Linux,
and it is in preview available for you right
now. But it does not have all the features yet that are in Visual Studio
on Windows or Visual Studio for Mac. And as it is
with Visual Studio Code, there's also some
more manual work, right? That's just how Visual Studio Code
works. There's a little bit more terminal commands and that kind of stuff, but
especially if you want to publish your apps, the commands can become rather
long and hard to remember. But luckily we also have an
amazing community and in this case, András, I hope I
pronounce your name correctly, from Budapest, Hungary, has created this amazing
visual studio code extension that will help you with another piece of .NET MAUI
development, namely the archiving and publishing of your .NET
MAUI apps to something that you can distribute to devices even
through App Stores. So let's just hop into Visual Studio Code and
I'm going to tell you all there is to know about this amazing extension.
So I'm showing you this from macOS today, but VS Code looks the exact
same across all the platforms that it supports, so it should look exactly
the same on Windows as well. And here I already have the page
open for this extension, so just go to this
extensions pane right here. Search for .NET MAUI Archive / Publish tool or just
search for .NET MAUI which will probably pop up and the buttons will be a
little bit different here because it will say install for you, install it and it
will be available inside of your vs. Code installation, which is really
cool. You can see here the ReaDMe so downloads it's almost a
crime, not even a thousand yet. So you can be
an early adopter, which is really cool and a little description of what
it is exactly. And I'm going to show you of course in this video which
is going to be great. So here we have the support of
platforms Android from macOS and Windows, right? Because we can build
Android from both macOS and Windows iOS only from macOS. That's just a
restriction from Apple. Maybe we have this amazing solution
from Visual Studio windows to actually connect to your Mac. Maybe
that will come for this extension, but maybe it's also like a little bit too much
for a community extension. So we'll see. And for Windows, kind of
like the same thing. We cannot build anything for Windows on a Mac, right?
So that's there. MacCatalyst planned for Q2 2024.
So stay tuned. But here the roadmap is even more
exciting. Direct upload to Google Play direct upload to test
flight and App Store. That would be really amazing if András could pull
that off because that would mean that you can go to the Google
Play Store and the App Store or TestFlight straight from Visual
Studio Code. So you would just have your app hack, hack, hack, hack, hack, creating
your app and boom, upload it to the store to your beta testers. That would be
really amazing if you could pull it off. And then after that MacCatalyst
published, right, the installation, super cool. I already just showed you how to do
that. You can go to the marketplace and get some more also about the
available commands, but I'm going to skip over that because that's just something
that you can show. Let's create a new .NET MAUI project first so I can show
you all the commands in action right here. I don't know if this extension
is actually dependent on the .NET MAUI Visual Studio Code extension,
so if it installs this extension that it will automatically install
the .NET MAUI extension. But I'm going to assume that you've installed that
extension as well. Else go watch that other video. I highly recommend that you do.
And whenever you have this, you can do command + P or control + P on Windows
angle bracket and you can do .NET and you will have all kinds of .NET
commands right here and you can dotnet new project. It's going to load all
the templates on your machine and you can instantiate all these new
projects ASP.NET, Blazor but also the. Net maui apps here right at
the top. Now you can totally do that or you can go into a
terminal, which I like to do and do dotnet new maui so it will create a new .NET MAUI project, -n so that I can
give it a custom name and then say PublishSample. So it's
going to generate the project files for me
right now. And then I can change directory. Did you know CD stands for change
directory? Publish sample and let's go in there
and then what you can do also a little pro
tip right here is code insiders. I use the insiders one else. It will
be just code dot which stands for the current directory -r and it
will reload this window and open this folder inside of your vs code instance. So that's
really cool. Right now the done and .NET MAUI VS Code
extension will kick in. It will start loading it as a solution, all
that kind of stuff in the background so you can start
building your .NET MAUI application. You can see some things popping in here. You can
see the solution explorer opening so you will have more of that Visual Studio
experience going on straight from visual studio code.
Again, I would highly recommend that you watch the other video right after this
one if you don't know what I'm talking about. I have some updates, that's all
fine, some output here and I'm just going to close that right
now. Okay, but now that we have this net Maui, I'm just going to use
this blank app because it's not about the. Net maui app. In
this case, what I can do is do it again, command P or control P
and do the angle bracket and you can see archive.
So we have all these archive commands right here.
And what is really cool is that Andras also links to the
documentation because the publishing procedure is very extensive, right? On Apple it's very
very extensive. It can be very complex. For Android a little
less so. But still there's a lot of steps to take, a lot of things that you need
to know before you can publish your app to the App Store. So I would
highly recommend that you read the documentation and really get an
understanding of what is going on here. But this extension will help you go
through the steps. So you will go to the actual official
Microsoft learn documentation by going through this links. And then
here you have the kind of like main commands publish windows, which
you cannot do from macOS, but if you're on Windows you can do that and it will
publish your Windows application, publish iOS so you can publish your iOS
application and publish Android. Now if you've done this before, then
you probably know for Android you need that key store that has a couple
of settings. For iOS you need provisioning profiles and all
that kind of stuff. And for Windows, I actually didn't test it out to be
very honest. But you would need some certificates as well. So I would hope
that this extension would generate some stuff for you, but otherwise it will
guide you through the steps for iOS. Let's start with iOS. List
provisioning profiles, right? So you could just list your provisioning profiles. I'm
not going to explain in detail what that all is about. Let me
know down in the comments. I'm starting to plan a little video about the
ultimate guide to the App Store and provisioning profiles. Would that
be interesting to you. Please let me know down in the comments. So I know it's
worth my time to look into that. But here we have a list of available
provisioning profiles. So it doesn't really tell you much
other than you can just list them and don't have to go to Xcode to actually
check it out. But you know that these are all here. So if we go back and again do this command and do
archive, archive. If I can type correctly the
same thing for like Android, you can list the key stores and check
the commands. Actually, I see I run into a bug or something
here or it's not, I haven't set my machine up correctly. I don't
know which one it is. Also for Android, you can generate a code
signing key right here, which is cool if you've done that before. If you've
created a key store, then you can go into here, you have to give it a name,
my key, you have to give it a password, or I think you can
actually leave it blank as well. I'm just going to choose some password
and then you have to provide some values so that it can use that to generate
and encrypt your key store. So let's just do Gerald and I
think you can skip some other things here, so blah, blah, blah. And then it
will generate your key store that you can now use to sign your application
as well. When you've done that, what you can
now do is Maui archive and you could just say,
hey, publish Android. And which project do you want me to publish?
Well, we just have one in this case, but you might have a project with
multiple. Net maui apps in there, so you can just choose which project you want
to publish. I'm just going to go with this one. Do you want to
have it signed or unsigned? Kind of like do you want to have it
all ready to go through the App Store or do you want to have an
unsigned one to just provide to a test device or something like that?
I'm going to go with unsigned right now because I don't have everything
set up for a signed one. I think you can choose APK or AAB, right? You can
just do that whichever you want. AAP is the new format that
you should use for the Google Play Store. But APK is still easier, I
think, to just distribute as a single file. So let's just do this
one. And you can see like the actual command it
runs here as well. So if you just want to know about that
one, you can see it from right here. You can inspect the
terminal output. What is going to happen here? So this vs code
extension just helps you to make this a little bit easier and do not
have to remember dotnetnet publish whole path identifier of the
platform that you want to do. Configuration release,
Android package format, blah blah blah blah. You don't need to
remember all that. I'm terrible at that. I have all kinds of notepads, sticky
notes everywhere with the commands and then I lose them. So it's
horrible. And now I don't have to anymore. I can just use this
extension. So it's going to run this. While it does, let's inspect this
other thing. There's also a couple of settings right here. So MAUI
archive settings and it's in the readme from the extension. There is a
little bit more description of what this is exactly. You can set the
Android key store directory, you can set the default
build configuration which is probably going to be released, right? You want to
have that release, build the net version to use. It does a lot of this out of
the box automatically. You don't have to worry about this. But if you
need to tweak some things in here, then you definitely can do that from
the settings right here. András, if you're watching this video,
this is just for you. I noticed a couple of typos here. This iOS
runtime seems a little bit weird. And this explicit iOS version, it's probably iOS here as well is a
little bit funny as well. So you might want to fix those. I will make
sure to have a buck report in your repository. So we have a couple
of settings here and normally you don't have to see these, but if
you have to tweak something then this is the place to do it and then it's still running that Android build. What
I can also do is publish iOS, which kind of like works the same
way. It follows the same path and I would expect it for Windows to do as
well. You can choose the project that it has to do. Select the
signing identity, right. You have this signing account for your Apple
development account that you need to have in place to actually go
to distribute your apps. So I have this one and then you
can select that provisioning profile. Now I have to select this wildcard
development thing, else it's not going to work. And
again, you can see the terminal output here. It will set all the kind of like build
arguments correctly. Like no one's going to remember this, right?
Code signing key is Apple development, blah blah blah blah blah. No one's
going to remember that this VS Code extension is awesome. It's going to
build my app and you can see it right here actually in the folder bin\release\Android\ publish and here is my aab apk aab. It has all the things. And for iOS
it's going to also build my application right here. Here in the publish folder
I'm going to find my app that is publishable to the App Store.
This is really great. So what do you think? Let me know down
in the comments if this is useful for you. I already mentioned
like András. I've been in contact with him. He's very open to feedback, so if you
have anything, it's all open source to you. You can contribute by opening an
issue, opening a pull request if you know the fix as well. But if you have
any amazing ideas for feature, that would be great. It would be
really great. I already mentioned it. If you could just publish straight to the
Google Play Store and App Store from visual studio code, that would be a huge time
saver for everyone, I guess. So I hope Andras will pull that off
and maybe you can help him a little with his open source project.
Let me know if there's anything else that you want to see down in the
comments below. And now is the time to check out the video about the .NET
MAUI VS Code extension, which you can see right here. And I'll be seeing you
on that one.