1

In my project, I am using several schematron(XML) files and build the project using MSBuild script.

Is there any way in MSBuild or in Powershell Commands to validate those XML files against XSD file like <validatexml> tag in NAnt??

If yes, then Please provide any example that shows how can we do it?

2

1 Answer 1

2

If you use the PowerShell Community Extensions there is a Test-Xml cmdlet that will validate XML e.g.

<Exec Command='PowerShell.exe -Command "& {Test-Xml -Path $(XmlPath) -Validate}"/>

Avoid using the -File parameter on PowerShell.exe. Certain versions of PowerShell don't return the correct exit code when this parameter is used.

Not the answer you're looking for? Browse other questions tagged or ask your own question.