Forum Xamarin.Android

Build Shared Forms Project for Android with XBUILD

pmhart83pmhart83 USMember ✭✭✭

I have seen a bunch of topics on this, but based on what I read they all seem the same.

I am trying to build my Android project / upload it to TestFairy using a shell script.

My build command looks like this:
$ xbuild "./Droid/App.Forms.Droid.csproj" /t:PackageForAndroid /p:Configuration="Debug" /p:Platform="AnyCPU"

It seems to sort of work but I get a bunch of errors like this:

"Replacing FeedbackPopup.InitializeComponent ()... failed."

".../FeedbackPopup.xaml: error : Failed to resolve assembly: '{AssemblyName}, Culture=neutral, PublicKeyToken=null'"

I can get some results using "MDTOOL" to the extent that it creates a bin folder / dlls and assets. But it does not create the APK. The command I used for that is this:

$ mdtool build -p:"App.Forms.Droid" -t:Build -c:"Debug" "App.sln"

I don't care if I use XBUILD or MDTOOL. I just want an APK to result from one of these.

The project is in Xamarin.Forms where the shared XAML is included as a "Shared Project" rather than a PCL.


  • JonDouglasJonDouglas USXamarin Team, University, Developer Group Leader Xamurai

    If you want an .apk, you'll need to use MSBuild and the target SignAndroidPackage.

    msbuild /p:Configuration=Release /t:SignAndroidPackage MyAndroidApp.csproj

    Although XBuild should also work, it is being slowly deprecated for MSBuild.

Sign In or Register to comment.