I have a development setup where I run a Windows VM on my Mac OS machine. I develop Xamarin apps using Visual Studio from the VM. Previously I would use the Xamarin Android Player on Mac OS, connecting to it from the Windows VM using adb connect -XAP ip- from Windows command line. In that way I could just connect to the XAP from Visual Studio, loved it!
Now, since the XAP is deprecated, I’ve gone back to the now much improved Android Emulator. Too bad connecting to the Android Emulator like with the XAP is so hard.
I’ve now written a bat script that can achieve this using an SSH tunnel (inspired by http://chrisriesgo.com/android-emulator-debugging-from-parallels-to-os-x/). Current requirements of the bat script are:
Solution for others
I would like to improve this by writing a Visual Studio extension so this setup can be used more easily by others. The setup is actually quite similar to the way the iOS setup works with the Xamarin Mac Agent. The Mac’s username and ip address are things the user can supply, that’s not too much to ask. But asking a user to convert their Mac’s SSH private key to the Putty format and place it in the correct Windows directory, that’s cumbersome.
Piggyback Xamarin Mac Agent
It would be nice if my extension can Piggyback on the Xamarin Mac Agent’s infrastructure. Users already connect to their Mac from Visual Studio. When the connection is setup, Xamarin stores SSH key’s in the path %LOCALAPPDATA%\Xamarin\MonoTouch. The files that are stored here after a successful connection are:
The id_rsa private key has a passphrase so I cannot simply convert it to the Putty type or use it any other way. I must have the passphrase in order to do that. I’ve tried using the contents of the passphrase.key file, but that doesn’t seem to be the passphrase. In what format is the passphrase.key file stored? (is it some kind of hash with the user's password?)
It would be very nice to be able to connect to the Mac’s emulator in a similar fashion as the Xamarin Mac Agent, the SSH key is really the only issue to write a nice Visual Studio Extension.
I hope somebody can help me out!