Write entire XML fragments in MSBuild with XmlPoke
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Namespace>
<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" />
</Namespace>
</PropertyGroup>
<Target Name="Poke">
<XmlPoke
XmlInputPath="Sample.xml"
Value="MyId"
Query="/dn:Package/mp:PhoneIdentity/@PhoneProductId"
Namespaces="$(Namespace)"/>
</Target>
</Project> <PropertyGroup>
<UserPropertyGroup>
<PropertyGroup>
<ActiveDebugProfile>$(StartupFile)</ActiveDebugProfile>
</PropertyGroup>
</UserPropertyGroup>
</PropertyGroup>
<XmlPoke XmlInputPath="$(MSBuildProjectFullPath).user"
Value="$(UserPropertyGroup)"
Query="/msb:Project"
Namespaces="$(UserProjectNamespace)"/>Last updated