diff --git a/src/NuGet.Clients/NuGet.CommandLine/MsBuildUtility.cs b/src/NuGet.Clients/NuGet.CommandLine/MsBuildUtility.cs index 86cfff81bd1..83d3a79a701 100644 --- a/src/NuGet.Clients/NuGet.CommandLine/MsBuildUtility.cs +++ b/src/NuGet.Clients/NuGet.CommandLine/MsBuildUtility.cs @@ -330,11 +330,14 @@ public static IEnumerable GetAllProjectFileNamesWithMsBuild( } catch (Exception ex) { + var exMessage = ex.Message; + if (ex.InnerException != null) + exMessage += " " + ex.InnerException.Message; var message = string.Format( CultureInfo.CurrentCulture, LocalizedResourceManager.GetString("Error_SolutionFileParseError"), solutionFile, - ex.Message); + exMessage); throw new CommandLineException(message); } diff --git a/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/NuGetRestoreCommandTest.cs b/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/NuGetRestoreCommandTest.cs index e36fbc2f6b6..b1b0f8ac6b6 100644 --- a/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/NuGetRestoreCommandTest.cs +++ b/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/NuGetRestoreCommandTest.cs @@ -1363,6 +1363,7 @@ public void RestoreCommand_InvalidSolutionFile() Assert.NotEqual(0, r.Item1); var error = r.Item3; Assert.True(error.Contains("Error parsing solution file")); + Assert.True(error.Contains("Error parsing a project section")); } }