title: How to fix "Add a reference to "MonoAndroid,Version=v12.0"" (actually trying to target 13) on XamarinAndroid build task for AzureDevops?
body: <p>I'm getting this error from a build script for Xamarin.Android that previously has worked for older versions of Android:</p>
  <pre><code>##[error]C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\NuGet\16.0\Microsoft.NuGet.targets(198,5): Error : Your project does not reference &quot;MonoAndroid,Version=v12.0&quot; framework. Add a reference to &quot;MonoAndroid,Version=v12.0&quot; in the &quot;TargetFrameworks&quot; property of your project file and then re-run NuGet restore.
  ##[debug]Processed: ##vso[task.logissue type=Error;sourcepath=C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\NuGet\16.0\Microsoft.NuGet.targets;linenumber=198;columnnumber=5;code=;]Your project does not reference &quot;MonoAndroid,Version=v12.0&quot; framework. Add a reference to &quot;MonoAndroid,Version=v12.0&quot; in the &quot;TargetFrameworks&quot; property of your project file and then re-run NuGet restore.
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\NuGet\16.0\Microsoft.NuGet.targets(198,5): error : Your project does not reference &quot;MonoAndroid,Version=v12.0&quot; framework. Add a reference to &quot;MonoAndroid,Version=v12.0&quot; in the &quot;TargetFrameworks&quot; property of your project file and then re-run NuGet restore. [D:\a\1\s\MyProject.Xamarin\MyProject.Android\MyProject.Android.csproj]
  ##[debug]Processed: ##vso[task.logdetail id=e408d669-be6f-49f1-b429-2e88049c5407;parentid=b84e3e4f-4467-4eae-9902-6f94de004f74;type=Build;result=Failed;finishtime=2022-08-31T13:01:13.7014902Z;progress=100;state=Completed;parentid=b84e3e4f-4467-4eae-9902-6f94de004f74;name=;]
  Done Building Project &quot;D:\a\1\s\MyProject.Xamarin\MyProject.Android\MyProject.Android.csproj&quot; (PackageForAndroid target(s)) -- FAILED.
  
  Build FAILED.
  </code></pre>
  <p>Initially, this error made sense to me. For a specific test configuration I was trying to build for, I didn't have a TargetFrameWork set in the Android project. I did when testing for debug on my machine and it built, so I set this to v13 (as this is the version I intend to distribute).</p>
  <p>Still the same error, so I set it to v12. And still the same error.</p>
  <p>I've also tried manually setting the JDK to 11 (the most recent, right?) and changing the version of Visual Studio to the latest (still 2019 according to the logs?).</p>
  <p>I've also set MS Build to be the latest, and set UseLatestPlatformSdk to be true. But still receiving this error.</p>
  <p>Here is the part of my script that is failing:</p>
  <pre><code>task: VSBuild@1
    inputs:
      solution: '**/*.sln'
      msbuildArgs: '/t:Restore'
      vsVersion: 'latest'
  
   task: XamarinAndroid@1
    inputs:
      projectFile: '**/*droid.csproj'
      outputDirectory: '$(outputDirectory)'
      configuration: '$(buildConfiguration)'
      msbuildVersionOption: 'latest'
      msbuildArguments: '/p:increaseBuildNumber=1'
      jdkOption: 'JDKVersion'
      jdkVersionOption: '1.11'
  </code></pre>
  <p>Documentation for building Xamarin.Android 13 on Azure Devops is slim. Does anybody see what I might be doing wrong? Can I manually set the Mono.Android version for this agent somewhere perhaps?</p>