Share via

XmlPoke task

Sets values as specified by an XPath query into an XML file.


The following table describes the parameters of the XmlPoke task.

Parameter Description
Namespaces Optional String parameter.

Specifies the namespaces for XPath query prefixes. Namespaces is an XML snippet consisting of Namespace elements with attributes Prefix and Uri. The attribute Prefix specifies the prefix to associate with the namespace specified in Uri attribute. Do not use an empty Prefix.
Query Optional String parameter.

Specifies the XPath query.
Value Required ITaskItem parameter.

Specifies the value to be inserted into the specified path.
XmlInputPath Optional ITaskItem parameter.

Specifies the XML input as a file path.


In addition to having the parameters that are listed in the table, this task inherits parameters from the TaskExtension class, which itself inherits from the Task class. For a list of these additional parameters and their descriptions, see TaskExtension base class.


Here is a sample.xml to modify:

<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
         xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" >
<Identity Name="Sample.Product " Publisher="CN=1234" Version="" />
<mp:PhoneIdentity PhoneProductId="456" PhonePublisherId="0" />

In this example, if you want to modify /Package/mp:PhoneIdentity/PhoneProductId, then use

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
        <Namespace Prefix="dn" Uri="http://schemas.microsoft.com/appx/manifest/foundation/windows10" />
        <Namespace Prefix="mp" Uri="http://schemas.microsoft.com/appx/2014/phone/manifest" />
        <Namespace Prefix="uap" Uri="http://schemas.microsoft.com/appx/manifest/uap/windows10" />

<Target Name="Poke">

dn is here used as an artificial namespace prefix for default namespace.

See also