Skip to content

Instantly share code, notes, and snippets.

@tylerjromeo
Last active December 11, 2021 09:33
Show Gist options
  • Save tylerjromeo/c148faf82a8041356e12accb5c564996 to your computer and use it in GitHub Desktop.
Save tylerjromeo/c148faf82a8041356e12accb5c564996 to your computer and use it in GitHub Desktop.
MsBuild targets to edit android build version in android manifest and iOS build version in info.plist
<Target Name="BeforeBuild" Condition=" $(SetVersion) == true ">
<XmlPoke XmlInputPath="Info.plist" Query="//dict/key[. = 'CFBundleVersion']/following-sibling::string[1]" Value="$(BuildNumber)" />
<XmlPoke XmlInputPath="Info.plist" Query="//dict/key[. = 'CFBundleShortVersionString']/following-sibling::string[1]" Value="1.0.$(BuildNumber)" />
</Target>
<Target Name="BeforeBuild" Condition=" $(SetVersion) == true ">
<XmlPoke XmlInputPath="Properties\AndroidManifest.xml" Namespaces="&lt;Namespace Prefix='android' Uri='http://schemas.android.com/apk/res/android' /&gt;" Query="manifest/@android:versionCode" Value="$(BuildNumber)" />
<XmlPoke XmlInputPath="Properties\AndroidManifest.xml" Namespaces="&lt;Namespace Prefix='android' Uri='http://schemas.android.com/apk/res/android' /&gt;" Query="manifest/@android:versionName" Value="1.0.$(BuildNumber)" />
</Target>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment