TaskAction="AddElement"
File="$(OutputPath)app\AndroidManifest.xml"
Key="android:name"
Value="%(AndroidPermissions.Identity)"
Element="uses-permission"
XPath="/manifest"/>
I have this task. It addes permissions to AndroidManifest file. All things going to manifest file have "android:" prefix to their properties. For some reason the stuff before ":" disappears in the output.
Comments: ** Comment from web user: mikeFourie **
Ok so if you use Prexif I think it works, but your element gets prefixed too, e.g.
<ItemGroup>
<AndroidPermissions Include="bob"/>
<AndroidPermissions Include="bob2"/>
<AndroidPermissions Include="bob3"/>
<Namespaces Include="Mynamespace">
<Prefix>andriod</Prefix>
<Uri>http://schemas.android.com/apk/res/android</Uri>
</Namespaces>
</ItemGroup>
<Target Name="Default">
<MSBuild.ExtensionPack.Xml.XmlFile TaskAction="AddElement" Prefix="andriod" File="d:\a\AndroidManifest.xml" Key="name" Value="%(AndroidPermissions.Identity)" Element="uses-permission" Namespaces="@(Namespaces)" XPath="/manifest"/>
</Target>
Result:
<andriod:uses-permission andriod:name="bob" xmlns:andriod="http://schemas.android.com/apk/res/android" />
<andriod:uses-permission andriod:name="bob2" xmlns:andriod="http://schemas.android.com/apk/res/android" />
<andriod:uses-permission andriod:name="bob3" xmlns:andriod="http://schemas.android.com/apk/res/android" />
I'll get a fix in to get this to work better.
Mike