Debug .NET MAUI Android apps with Android work profile
An Android Work Profile is a feature that allows you to separate work apps and data from personal apps and data on the same device. This is particularly useful for maintaining privacy and security in a corporate environment. However when you are developing an app for your company, who’s got these configurations on their mobile devices, you might find yourself in a tricky solution, because VS Code simply installs the app on the workprofile and on the normal profile aswell, but only can run with debug on the normal profile without any configuration. Get the users of the Android device To list users on an Android device using ADB (Android Debug Bridge), you can use the following command: This command will display a list of users on the device, including their user IDs. For example, the output might look something like this: Configure the .csproj to launch the app on work profile Insert the following line within the <PropertyGroup> section of your .csproj file: This attribute specifies the user ID for the Android Work Profile. The user ID 10 is commonly used for work profiles, but you should verify this for your specific setup. Last but not least: Hit F5 and Run your project 🙂 Remark: This solution is only working in Visual Studio for Windows, and Visual Studio Code on mac.
.NET MAUI iOS – Can’t launch the app, crashes on splash screen error
This content has 8 months. Some of the information in this post may be out of date or no longer work. Please, read this page keeping its age in your mind.If you are facing issues launching your iOS application in VS Code, then try to analyse the Debug Console of your application.If you see things like this: And then your application suddenly crashes showing the splashscreen, then the debugger might be slow. XCode 15 have problems with debugging. If you have “Connect via network” enabled on your XCode settings under Devices and Simulators, than this might be the problem. Even if you are connecting your phone wired, it starts the application debugging via wifi. Try updating XCode to 15.4, and update your OS to macOS Sonoma 15.4 aswell You can countercheck this problem by disabling the wifi on your physical device. In this case the app installs, but crashes instantly when trying to launch it. Additionally in Visual Studio code the solution you can disable some settings in the C# extension’s settings the Debug > Logging to speed up the loading progress when launching your app.
Publishing .NET MAUI Apps with VS Code
This content has 12 months. Some of the information in this post may be out of date or no longer work. Please, read this page keeping its age in your mind.In this tutorial, I will guide you through the step-by-step process of publishing .NET MAUI apps using Visual Studio Code and the ‘.NET MAUI – Archive / Publish tool’ extension by me. This extension simplifies the publishing process by providing a user-friendly interface within VS Code. Without the help of an extension You will need to dive into a terminal, and give out the following commands, based on which platform you want to build for. You can learn more, how to do it without my extension at: https://learn.microsoft.com/en-us/dotnet/maui/ios/deployment/publish-cli?view=net-maui-8.0andhttps://learn.microsoft.com/en-us/dotnet/maui/android/deployment/publish-cli?view=net-maui-8.0 But don’t waste your time. I’ve put together a Visual Studio Code extension for you that will easily save you those unnecessary lines and allow you to publish from the UI. Step 1: Install VS Code Extension Visit the VS Code Marketplace and install the ‘.NET MAUI – Archive / Publish tool’ extension by ‘banditoth’. You might be required to reload your VS Code instance. Step 2: Open Your .NET MAUI Project Launch Visual Studio Code and open your .NET MAUI project. Step 3: Access the Command Palette Press Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (Mac) to open the command palette in Visual Studio Code. Step 4: Choose Publish Android or Publish iOS Type ‘MAUI Publish’ in the command palette. You will see two options: ‘MAUI: Publish Android’ and ‘MAUI: Publish iOS’. Select the…
Hi, I am András,
I am a seasoned software engineer from Budapest, Hungary with a strong focus on mobile app development using .NET MAUI and Xamarin.Forms. My expertise also extends to website building for my happy customers and other complex system designing. I am passionate about developing well-organized, maintainable software solutions.