Xamarin.UWP deployment failure: 0x80073D1F

Registering the application to run from layout...
DEP0700: Registration of the app failed. [0x80073D1F] 
	DeploymentSucceeded = False
	DeploymentError = Err_Deploy_Register
	DeploymentUserError = False
	DeploymentHRESULT = 2147958047
	HasSharedCode = False
	Target.Id = 512
	ProjectGuid = {5894aed2-9bb1-434b-8b49-3b86572709b7}
	Project.TargetPlatformVersion = 10.0.19041.0
	Project.TargetPlatformMinVersion = 10.0.17763.0
Deleting file "vs.appxrecipe" from layout...
DeployAsync: END (Failure, 0:00:01.499)
Deploy: END (Failure, 0:00:01.5)

Solution

Remove your application source code from shared folder
or
You are being signed in with my Microsoft account in windows instead of the local user account
or
Visual Studio is not able to delete the application data in your local packages folder, go to C:\Users\<YOURNAME>\AppData\Local\Packages\ folder, and delete your applications folder manually.
or
browse more solution at here
🙂

This content has 2 years. 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.

Xamarin.Forms: Prevent dark mode on iOS, Android

To enforce light mode on the following platforms use this code

iOS Solution

Open up you info.plist file and add the following key:

<key>UIUserInterfaceStyle</key> 
<string>Light</string>

Android Solution

Put this code into your MainAcitivity.cs

AppCompatDelegate.DefaultNightMode = AppCompatDelegate.ModeNightNo;
This content has 2 years. 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.

System.Text.Json dictionary deserialisation issue with Refit

If you find that your Dictionary object, if it has a string key, and it is not deserialized with its first initial capitalized, and you are using System.Text.Json serializer, here is the solution.

This is only applies to some versions of the Refit NuGet package, where NewtonSoftJson is not the default serializer.

Solution using Refit

Define RefitSettings when creating your rest service, like this:

RestService.For<IAnythingApi>(
			Constans.BackendApiUrl,
			new RefitSettings
			{
				ContentSerializer = new SystemTextJsonContentSerializer(
                    new JsonSerializerOptions
					{
						DictionaryKeyPolicy = JsonNamingPolicy.CamelCase
                    }),
			});

This solution will allow you to deserialise with uppercase letter key 🙂

This content has 2 years. 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.

SourceTree keeps asking for password on macOS

If you are experiencing that the sourcetree is keeps asking for username and/or password when fetching, pushing, pulling, commiting to a repository, open up a terminal and execute the following command

git config --global credential.helper osxkeychain

This happened for me after installing a third party password manager, called LastPass.

This content has 2 years. 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.

Upgrading Xamarin.Forms projects to .NET MAUI with upgrade assistant

MAUI is still in preview state, so the production apps are not recommended to upgrade to .NET MAUI. But it is important to be open to new technology, so take some time to review the update.

It’s possible that by the time you read this post, you’ll be able to convert a MAUI projects from UI, but it’s not currently an available feature for me.

What you will need

  • Windows machine
  • Visual Studio 2022 installed

Install required tools for MAUI

Open a command prompt and give out the following command:

dotnet workload install maui

If you have installed maui already, then you wont need to run this command again.

Install upgrade-assistant

There is a tool developed by Microsoft, not originally for MAUI, but because it is based on a fully extensible model, it has been made available for MAUI projects. Xamarin.Forms projects can be translated to the new version of the projects with this app:
https://dotnet.microsoft.com/en-us/platform/upgrade-assistant

dotnet tool install --global upgrade-assistant

Use the upgrade assistant

It is important to note that this application cannot independently translate Xamarin.Forms apps to MAUI. It only helps us in the upgrade process.

That’s why the app asks for constant instructions, so we can’t leave the machine running while we make coffee 🙂

Let’s change the directory of your command prompt to the directory where you store the .sln file

upgrade-assistant upgrade SolutionName.sln

Watch out for the output of the console. If everything goes well, your solution can be transformed to maui without issues.

In the header section of the console output, you will see what steps are required (or suggested) in order to complete the migration. You can decide what to do with the next step: Apply, skip, or do something else with it. If everything goes well, you will only need to press apply.

The output of the upgrade-assistant

Once you have finished the upgrade assistant process, you can see the changes. Mostly in source codes and project files.

Namespace changes

This content has 2 years. 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.