I’m in the process of moving our Xamarin build infrastructure to be Windows based and I’ve hit a problem in that our build scripts currently use PlistBuddy to read from and write to the Info.plist file of an app.
Obviously PlistBuddy won’t run on Windows.
Has anyone seen any other solution for interacting with Plist files on Windows? I’ve seen a few that use a GUI but we would need this to have a CLI.
You can force the Build Agent to run arbitrary commands on the Mac via tying into any generic
Task/Target(You can look in the Xamarin.iOS.targetsfiles for a better idea here) that runs across the SSH connection. This is currently available in another method by using the<Exec>Task with aSessionIdof your$(BuildSessionId). Here's an example of how you might do this:If the
SessionIdis null/empty, then that means we are not connected to the Mac. If it's not null/empty, then we are connected to the Mac.We can then force this condition to always run on the Mac via:
Please note that the following built-in tasks are exposed for remote execution:
Source: https://github.com/xamarin/xamarin-macios/blob/fc55e4306f79491fd269ca2495c6a859799cb1c6/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets#L74-L80
You can then invoke the
PlistBuddyCommand via this method.EX:
If you wanted to go about a
MSBuildcustom Task way, You can see examples of previous built Tasks here:https://github.com/xamarin/xamarin-macios/tree/fc55e4306f79491fd269ca2495c6a859799cb1c6/msbuild/Xamarin.iOS.Tasks.Core/Tasks
EX Plist in Use:
https://github.com/xamarin/xamarin-macios/blob/fc55e4306f79491fd269ca2495c6a859799cb1c6/msbuild/Xamarin.iOS.Tasks.Core/Tasks/MTouchTaskBase.cs#L608
EX Tests with Plist:
https://github.com/xamarin/xamarin-macios/tree/fc55e4306f79491fd269ca2495c6a859799cb1c6/msbuild/tests/Xamarin.iOS.Tasks.Tests/TaskTests/GeneratePlistTaskTests
This is more of a MSBuild customization at this point, but it's definitely possible to do what you're trying to do using these items.