I need to read from an XML using MSBuild. Here is the structure of the XML file
<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04">
<Obj RefId="0">
<TN RefId="0">
<T>Selected.System.Management.Automation.PSCredential</T>
<T>System.Management.Automation.PSCustomObject</T>
<T>System.Object</T>
</TN>
<MS>
<S N="UserName">domain\username</S>
<S N="Password">some password text</S>
</MS>
</Obj>
</Objs>
I am trying to use MSBuild Extensions to read the XML and store it into a Build Variable like so
<Target Name="LoadCredentialFile">
<ItemGroup>
<Namespaces Include="Mynamespace">
<Prefix>x</Prefix>
<Uri>http://schemas.microsoft.com/powershell/2004/04</Uri>
</Namespaces>
</ItemGroup>
<MSBuild.ExtensionPack.Xml.XmlFile TaskAction="ReadAttribute"
File="$(MSBuildProjectDirectory)\DeploymentCredential.xml"
XPath="/Objs/Obj/MS/S[@N='Password']"
Value="$(Credential)" />
<Message Text="Credential: $(Credential)" Importance="high" />
</Target>
However, the message that I output always has nothing in the variable I created. I would like the variable to be populated with "some password text"