You have to love these days when everything seems to go haywire at the same time. Your code no longer compiles, your CI build status turns red and your unit tests become flaky.
Today turned out to be one of such days as our build started to fail with the following error message:
System.AggregateException: One or more errors occurred. ---> NuGet.CommandLine.CommandLineException: Error parsing solution file at D:\b\3\_work\154\s\Source\MyApp\MyApp.sln: Exception has been thrown by the target of an invocation.
In our pipeline we were using the NuGetToolnstaller task:
- task: NuGetToolInstaller@1
inputs:
versionSpec: '4.x'
We had just installed the latest version of the Visual Studio Build tools on our build server. This new version has a breaking change with regard to older versions of NuGet.
As a fix, we switched to a newer NuGet version:
- task: NuGetToolInstaller@1
inputs:
versionSpec: '5.x'
That’s it!