The Windows-2019 runner image in Azure DevOps is being deprecated, and pipelines using the Windows-2019 hosted agent display a warning recommending a switch to a newer hosted agent. However, after changing the agent, build pipelines may break due to dependency and environment differences. This blog explains a NuGet restore failure that occurred after switching to Windows-2022 and provides a solution for it.
Warning: The windows-2019 runner image is being deprecated, consider switching to windows-2022 (windows-latest) or windows-2025 instead
##[error]The nuget command failed with exit code(1) and error(Error parsing solution file at D:\a\1\s\ABC\ABCAPI.sln: Exception has been thrown by the target of an invocation.)
##[error]Packages failed to restore
Reason for the failure: The Windows-2022 hosted agent does not support NuGet version 4.4.1.
Solution: Update the NuGet version to 6.x in the NuGet Tool Installer step of the Azure DevOps build pipeline.
No comments:
Post a Comment