How to use XmlPeek task?

后端 未结 1 1403
[愿得一人]
[愿得一人] 2020-12-14 07:42

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.

相关标签:
1条回答
  • 2020-12-14 08:25

    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="&lt;Namespace Prefix='msb' Uri='http://schemas.microsoft.com/developer/msbuild/2003'/&gt;"
                 XmlInputPath="$(MSBuildProjectFile)" 
                 Query="/msb:Project/msb:Target[@Name='TestXmlPeek']/msb:Message">
          <Output TaskParameter="Result" ItemName="Peeked" />
        </XmlPeek>
    
        <Message Text="@(Peeked)"/>
      </Target>
    </Project>
    
    0 讨论(0)
提交回复
热议问题