I'm having some trouble getting MSBuild extensions 4.0 to update an XML file once a namespace is involved.
When I have a simple XML file with no namespace then fine, but once i attempt to update an xml file that has a namespace set, then nothing happens .. notice there is no error tho.
Here are the simple ones that work fine
<Project>
<PropertyGroup>
<ApplicationVersion>5.1.500.16</ApplicationVersion>
</PropertyGroup>
<PropertyGroup>
<ApplicationVersion>old</ApplicationVersion>
</PropertyGroup>
</Project>
and project file
<Project ToolsVersion="4.0" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TPath>C:\Program Files\MSBuild\ExtensionPack\4.0\MSBuild.ExtensionPack.tasks</TPath>
<AssemblyVersion>5.1.500.18</AssemblyVersion>
</PropertyGroup>
<Import Project="$(TPath)"/>
<Target Name="Default">
<MSBuild.ExtensionPack.Xml.XmlFile TaskAction="RemoveElement" " File="c:\build\test.csproj" XPath="/Project/PropertyGroup[1]/ApplicationVersion" />
</Target>
</Project>
Wheras these dont do anything !
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://mynamespace">
<PropertyGroup>
<ApplicationVersion>5.1.500.16</ApplicationVersion>
</PropertyGroup>
<PropertyGroup>
<ApplicationVersion>old</ApplicationVersion>
</PropertyGroup>
</Project>
and
<Project ToolsVersion="4.0" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TPath>C:\Program Files\MSBuild\ExtensionPack\4.0\MSBuild.ExtensionPack.tasks</TPath>
<AssemblyVersion>5.1.500.18</AssemblyVersion>
</PropertyGroup>
<Import Project="$(TPath)"/>
<ItemGroup>
<Namespaces Include="Mynamespace">
<Prefix>me</Prefix>
<Uri>"http://mynamespace"</Uri>
</Namespaces>
</ItemGroup>
<Target Name="Default">
<MSBuild.ExtensionPack.Xml.XmlFile TaskAction="RemoveElement" Namespaces="@(Namespaces)" File="c:\build\test.csproj" XPath="//me:Project/PropertyGroup[1]/ApplicationVersion" />
</Target>
</Project>
So what's the deal ? what am i missing ? Is it the formatting of the XPath in the second instance ? I've tried all kinds of variations.