Error XA1042 de .NET para Android

Mensajes de ejemplo

error XA1042: The <instrumentation> element in 'obj/Debug/net11.0-android/android/AndroidManifest.xml' is missing the android:name attribute.

Issue

dotnet run inicia una aplicación sin un <activity> ejecutable a través del elemento <instrumentation>, pero el elemento <instrumentation> que se encuentra en AndroidManifest.xml no tiene atributo android:name, por lo que no hay ninguna clase que iniciar.

Solution

Asigne un nombre al <instrumentation> elemento. Si está declarado en su AndroidManifest.xml escrito manualmente, añada el atributo:

<instrumentation android:name="com.companyname.myapp.MyInstrumentation" />

Si el elemento se genera a partir de una Android.App.Instrumentation subclase, establezca la Name propiedad en el [Instrumentation] atributo :

[Instrumentation (Name = "com.companyname.myapp.MyInstrumentation")]
public class MyInstrumentation : Instrumentation
{
}

Como alternativa, establezca la propiedad $(AndroidInstrumentation) de MSBuild en el nombre de la clase que se va a iniciar.