Skip to content

Commit cac4eb1

Browse files
Dmitry Avtonomovarturcic
Dmitry Avtonomov
authored andcommitted
Add local project file location to exception when parsing fails
Helps in solutions with multiple projects, when one of csproj files becomes corrupt. User knows where to apply fixes.
1 parent 8cd3a1b commit cac4eb1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/GitVersion.Core/VersionConverters/AssemblyInfo/ProjectFileUpdater.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,15 @@ public void Execute(VersionVariables variables, AssemblyInfoContext context)
4747
var localProjectFile = projectFile.FullName;
4848

4949
var originalFileContents = this.fileSystem.ReadAllText(localProjectFile);
50-
var fileXml = XElement.Parse(originalFileContents);
50+
XElement fileXml;
51+
try
52+
{
53+
fileXml = XElement.Parse(originalFileContents);
54+
}
55+
catch (XmlException e)
56+
{
57+
throw new XmlException($"Unable to parse file as xml: {localProjectFile}", e);
58+
}
5159

5260
if (!CanUpdateProjectFile(fileXml))
5361
{

0 commit comments

Comments
 (0)