Forum Xamarin.Android

Running build from command line fails

I just upgraded my build server to 4.6. It is Windows Server 2003.

Now the following command does not work.

"C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv" AndroidSolution.sln /deploy "Release"

I get a long message about "object reference not set to an instance of an object".

It works when I do it from inside of Visual Studio.

See the attached file.

I just did the install from inside Visual Studio. However, when I try to run the complete install from your main page nothing happens. When I compare my build server to my desktop the registry keys are different but on my desktop I did the complete install from the main page.


  • JonathanPryorJonathanPryor USXamarin Team Xamurai
    "C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv" AndroidSolution.sln /deploy "Release"

    I've never seen that style command before. I do not know how it works.

    For command-line installs, I suggest using MSBuild directly:

    msbuild /t:Install App.csproj
  • TomOpgenorthTomOpgenorth CAXamarin Team Xamurai
    edited April 2013

    As you're using Windows, I'd like point out that we do have a sample Powershell script on the docs site that will take care of compile, signing, and zip-aligning your project for you:

    # First clean the Release target.
    msbuild.exe HelloWorld.csproj /p:Configuration=Release /t:Clean
    # Now build the project, using the Release target.
    msbuild.exe HelloWorld.csproj /p:Configuration=Release /t:PackageForAndroid
    # At this point there is only the unsigned APK - sign it.
    # The script will pause here as jarsigner prompts for the password.
    # It is possible to provide they keystore password for jarsigner.exe by adding an extra command line parameter -storepass, for example
    #    -storepass <MY_SECRET_PASSWORD>
    # If this script is to be checked in to source code control then it is not recommended to include the password as part of this script.
    & 'C:\Program Files\Java\jdk1.6.0_24\bin\jarsigner.exe' -verbose -sigalg MD5withRSA -digestalg SHA1  -keystore ./xample.keystore -signedjar        
    ./bin/Release/mono.samples.helloworld.apk publishingdoc
    # Now zipalign it.  The -v parameter tells zipalign to verify the APK afterwards.
    & 'C:\Program Files\Android\android-sdk\tools\zipalign.exe' -f -v 4
    ./bin/Release/mono.samples.helloworld-signed.apk ./helloworld.apk
  • Jonathan - I made the change to MSBuild and everything is fine now.

    Tom - Thanks for the link to the Powershell script.

Sign In or Register to comment.