Thursday 12 October 2017

Mistake in .sln Can Cause NuGet Restore Task in Build to Fail and Hide the Real Issue

NuGet packages are very commonly used in VS Development. Using build VSTS task NuGet Restore is general practice of downloading packages while doing the automated builds. Today suddenly a team ran into the same issue described here https://developercommunity.visualstudio.com/content/problem/97737/error-da-toolnuget400x64nugetexe-failed-with-retur.html. Let’s have a look at the real issue caused this error in this particular teams’ instance and how it was found and resolved.


The Issueimage

#[error]Error: d:\a\_tasks\NuGetInstaller_333b11bd-d341-40d9-afcf-b32d5ce6f23b\0.2.31\node_modules\nuget-task-common\NuGet\3.5.0\NuGet.exe failed with return code: 1

##[error]Packages failed to install

Steps Taken

After couple of hours effort to fix NuGet restore and investigating if there is any NuGet packages added to any project, there was no options left other than disabling the task. After disabling and let the VS build task to restore NuGet packages it revealed the real issue stated below.

xxxx.sln(1557,0): Error MSB5023: Error parsing the nested project section in solution file. A project with the GUID "{69A52FD2-2433-4BF4-B03F-8206C6793AA8}" is listed as being nested under project "{37C56D57-C241-4D8B-A04A-858B36C36134}", but does not exist in the solution.

This was the issue fixing change done in.sln file nested projects section. This project was moved to a different solution folder hierarchy and developer has committed the code with incorrect entry in sln file. image

Incorrect update of VS version back set back to the correct version.image

Conclusion

The NuGet restore did not have any issue. It was unable to validate the sln file which is causing NuGet restore to fail. But the problem was really in the sln file.

No comments:

Popular Posts