开发者

MsBuild: Read part of the file using ReadLinesFromFile

开发者 https://www.devze.com 2023-01-08 16:05 出处:网络
I need to read the XML from the file. I use following c开发者_如何学编程ode: <ItemGroup>

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

精彩评论

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