Microsoft.Graphics.Canvas.winmd cannot be referenced MAUI Error

If you get this error and you target only  android or ios environment please check your project file and delete this code block. 

	<ItemGroup Condition="$(TargetFramework.Contains('-windows'))">
		<!-- Required - WinUI does not yet have buildTransitive for everything -->
		<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.0" />
		<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.0.30" />
	</ItemGroup>

 

Run a MAUI project on Android devices of different architectures

Recently Visual Studio gave the following error when I tried to run the MAUI project on a Samsung T580 tablet 

Mono.AndroidTools.IncompatibleCpuAbiExceptiopn: The package does not support the CPU architecture of this device

After many attempts, the problem was solved by adding the following line to the project file that contains the mobile platforms.

<RuntimeIdentifiers Condition="$(TargetFramework.Contains('-android'))">android-arm;android-arm64;android-x86;android-x64</RuntimeIdentifiers>

 

Also you need to add this line the project file

 <PropertyGroup>
<RuntimeIdentifiers Condition="$(TargetFramework.Contains('-android'))">android-arm;android-arm64;android-x86;android-x64</RuntimeIdentifiers>
</PropertyGroup>

CSS not loading when running MAUI project on Mac OS.

I ran into a weird problem today while running the MAUI Blazor project on Mac OS via Visual Studio Code. CSS files were not loading on Mac OS although there was no problem on Windows. After some research, I realized that the problem was caused by the case sensitivity of linux. When I changed the name of the index.html file in the wwwroot folder to Index.html, the css was loaded. It may be due to the Turkish language, but I wanted to share it thinking that others can experience it too.

Maui WinUI project Unable to start debugging error

Due to a bug we are unable to debug and run WinUI projects in .net 6.0.100 preview 7.21379.14. It was said that the Visual Studio team will fix this with an update. Temporarily, after you deploy your projects, you can run them without debugging by typing the solution name of the start menu.