Skip to content

Instantly share code, notes, and snippets.

@xgenvn
Forked from tylerjromeo/targets.xml
Created March 30, 2017 12:34
Show Gist options
  • Save xgenvn/32dd04b7c3163b69e137b8c64c48c832 to your computer and use it in GitHub Desktop.
Save xgenvn/32dd04b7c3163b69e137b8c64c48c832 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