Category Archives: VSTS

VSTS–Mac build agent fail restoring NuGet packages

Heads up if you’re running VSTS build agent on a Mac for Xamarin.Forms iOS projects.

You may see this error message from the NuGet package restore step:
”To connect to NuGet feeds hosted in your Team Services account/TFS project collection with NuGet 3.1 or below, edit your build definition to specify a path to a NuGet.config containing the package sources you wish to use.”
 
And this error message in the agent’s _diag log file on the Mac:
                MsBuild.exe does not exist at ‘/Library/Frameworks/Mono.framework/Versions/4.4.2/lib/mono/4.5/msbuild.exe’.
 
It’s a closed issue on GitHub, but you’ll need to do a workaround.
 
See https://github.com/Microsoft/vsts-tasks/issues/2828 for details. The issue was opened about 10 days ago.
 
I hadn’t changed anything with my build definition, source code, or build agent, but the build failed this morning. (It had been a couple of weeks since I’d run it, and it had always worked before. Quite a surprise.
 
I ended up putting this in the VSTS NuGet package restore step and it resolved the issue for me:

2016-10-17_10-26-36

Note from Joe Sauve:

You can also use:
“/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/nuget/NuGet.exe”

Note the “Current” instead of a specific version number. There should be a symlinked “Current” folder in there that always points to the most recent version.

Thanks Joe!

bliz

Android Keystore file and password in VSTS builds

I was on site with a client last week working with them on DevOps for Xamarin.Forms builds using VSTS. The question came up of what to do about the Android Keystore file and its password – where to put them, keep them safe, etc.

Keystore file
If you’re running the build agent on a local build server (or Azure VM), the keystore file can be placed in a secure location on the build server. If you’re using the hosted build controller the Keystore file could be put into source control with limited access given to that file.

Keystore file password
For the Keystore file password, create a private variable in the Android build definition . Once the variable is set it cannot be displayed again. Then set the permissions in VSTS so only those who have Build Edit permissions can change this variable, and restrict who you give those permissions to accordingly.

clip_image001
The build step with a reference to the Keystore file in VSTS source control and a variable for the password.

image
The Keystore password saved as a Variable in the build definition.

Then you’ll need to set the security on the Build itself to limit who is allowed to edit the build definition.

image

image

And that’s it. Setting up the VSTS build in this way will keep the Keystore file and password safe in your Xamarin Android build definitions.

Enjoy!
–bliz