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
精彩评论