I've read in the MSDN MSBuild Task Reference about XmlPeek task at http://msdn.microsoft.com/en-us/library/ff598684(v=VS.100).aspx but I cannot use it in my MSBuild script. If you have used this before, please show me how!
+2
A:
The XmlPeek task is only available in MSBuild for .NET 4. So you need to use MSBuild v4.0 and specify in your msbuild file the tool version you are using.
Here a sample project file, where we are looking for the message node.
<Target Name="TestXmlPeek">
<XmlPeek Namespaces="<Namespace Prefix='msb' Uri='http://schemas.microsoft.com/developer/msbuild/2003'/&gt;"
XmlInputPath="$(MSBuildProjectFile)"
Query="/msb:Project/msb:Target[@Name='XmlPeek']/msb:Message">
<Output TaskParameter="Result" ItemName="Peeked" />
</XmlPeek>
<Message Text="@(Peeked)"/>
</Target>
</Project>
madgnome
2010-04-22 09:47:32
+1 for a good example using the same file via $(MSBuildProjectFile)
Sayed Ibrahim Hashimi
2010-04-23 22:09:56
Thanks madgnome! It works now after I put ToolVersion=4.0 in the Project tag. The weird thing is that I'm running MSBuild Engine version 4.0.30319.1 as default but this "higher" version doesn't support XmlPeek!
Nam Gi VU
2010-04-27 08:30:52