How to fix - Could not compile native assembly file: environment

Anonymous
2023-04-12T08:55:49.4733333+00:00

I am getting compile time errors on newly created .NET MAUI project. After creating project when I run it (without modifying anything) I get below errors

Error XA3006 Could not compile native assembly file: environment.arm64-v8a.ll C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.46\tools\Xamarin.Android.Common.targets XA3006 Could not compile native assembly file: typemaps.armeabi-v7a.ll C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.46\tools\Xamarin.Android.Common.targets XA3006 Could not compile native assembly file: typemaps.x86_64.ll C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.46\tools\Xamarin.Android.Common.targets XA3006 Could not compile native assembly file: environment.armeabi-v7a.ll C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.46\tools\Xamarin.Android.Common.targets XA3006 Could not compile native assembly file: typemaps.x86.ll C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.46\tools\Xamarin.Android.Common.targets

This is the screenshot of error User's image

Visual Studio Version Detail -

Microsoft Visual Studio Professional 2022
Version 17.5.4
VisualStudio.17.Release/17.5.4+33530.505
Microsoft .NET Framework
Version 4.8.04161

Installed Version: Professional

C# Tools   4.5.2-3.23171.7+d17f741546fad2786cbd6394d08644e53a36dkk
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Mono Debugging for Visual Studio   17.5.9 (11975e6)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager   6.5.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/


Xamarin   17.5.0.173 (d17-5@33e727c)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   17.5.3.46 (remotes/origin/d17-5@e4dd80b2bb)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin.Android SDK   13.2.0.0 (d17-5/797e2e1)
Xamarin.Android Reference Assemblies and MSBuild support.
    Mono: 6dd9def
    Java.Interop: xamarin/java.interop/main@149d70fe
    SQLite: xamarin/sqlite/3.40.0@fdc1e34
    Xamarin.Android Tools: xamarin/xamarin-android-tools/main@9f02d77

I am not sure how to fix it. Similar question, I have found here and tried given solution still not working - https://learn.microsoft.com/en-us/answers/questions/1199060/not-able-to-build-net7-0-android-project-in-vs-for?source=docs

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,594 questions
{count} vote

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.