开发者

MsBuild: Read part of the file using ReadLinesFromFile

I need to read the XML from the file. I use following c开发者_如何学编程ode:

<ItemGroup>
<SourceXsltFile Include="SourceFile.xml" />
</ItemGroup>

<ReadLinesFromFile File="@(SourceXsltFile)">
  <Output TaskParameter="Lines" ItemName="FileContents" />
</ReadLinesFromFile>

But I need only the part of the file's content to be copied which resides inside the <XSL> tag.

Any ideas?


In 4.0+ there are XmlPeek, XmlPoke, and XslTransform tasks you can use here. See MSDN.


  • http://msbuildtasks.tigris.org/ - use RegexMatch task with something like - <XSL\b[^>]*>(.*?)</XSL> (not sure about exact correctness though).

  • Write your own custom task

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜