Reputation: 731
My solution compiles in VS2017 and VisualStudioVersion = 14.0.25420
Nuget restore fails in vsts build definition.Have performed below steps:
I have referred below links and tried executing them, but still same error was thrown:
Using the latest NuGet in your build
Still no luck.
2018-03-16T08:30:20.9863624Z Task : NuGet 2018-03-16T08:30:20.9863815Z Description : Restore, pack, or push NuGet packages, or run a NuGet command. Supports NuGet.org and authenticated feeds like Package Management and MyGet. Uses NuGet.exe and works with .NET Framework apps. For .NET Core and .NET Standard apps, use the .NET Core task. 2018-03-16T08:30:20.9863996Z Version : 2.0.24 2018-03-16T08:30:20.9864098Z Author : Microsoft Corporation 2018-03-16T08:30:20.9864232Z Help : More Information 2018-03-16T08:30:20.9864356Z ============================================================================== 2018-03-16T08:30:23.3611981Z Caching tool: NuGet 4.1.0 x64
2018-03-16T08:30:23.3717038Z Found tool in cache: NuGet 4.1.0 x64
2018-03-16T08:30:23.3790881Z Resolved from tool cache: 4.1.0
2018-03-16T08:30:23.3791208Z Using version: 4.1.0
2018-03-16T08:30:23.3794629Z Found tool in cache: NuGet 4.1.0 x64
2018-03-16T08:30:23.4907509Z [command]C:\Windows\system32\chcp.com 65001
2018-03-16T08:30:23.5489365Z Active code page: 65001
2018-03-16T08:30:23.5831075Z Detected NuGet version 4.1.0.2450 / 4.1.0
2018-03-16T08:30:23.5953230Z SYSTEMVSSCONNECTION exists true
2018-03-16T08:30:23.5976398Z Saving NuGet.config to a temporary config file.
2018-03-16T08:30:23.6021481Z [command]D:\a_tool\NuGet\4.1.0\x64\nuget.exe sources Add -NonInteractive -Name NuGetOrg -Source https://api.nuget.org/v3/index.json -ConfigFile D:\a\1\Nuget\tempNuGet_13.config
2018-03-16T08:30:26.0565743Z Package Source with Name: NuGetOrg added successfully.
2018-03-16T08:30:26.0571052Z Saving NuGet.config to a temporary config file.
2018-03-16T08:30:26.0704297Z [command]D:\a_tool\NuGet\4.1.0\x64\nuget.exe restore D:\a\ts.sln -Verbosity Detailed -NonInteractive -ConfigFile D:\a\1\Nuget\tempNuGet_13.config
2018-03-16T08:30:29.9861727Z NuGet Version: 4.1.0.2450
2018-03-16T08:30:29.9862227Z MSBuild auto-detection: using msbuild version '15.6.82.30579' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
2018-03-16T08:30:29.9863068Z System.AggregateException: One or more errors occurred. ---> NuGet.CommandLine.CommandLineException: Error parsing solution file at D:\a\ts.sln: Exception has been thrown by the target of an invocation.
2018-03-16T08:30:29.9868970Z at NuGet.CommandLine.MsBuildUtility.GetAllProjectFileNamesWithMsBuild(String solutionFile, String msbuildPath)
2018-03-16T08:30:29.9869367Z at NuGet.CommandLine.RestoreCommand.ProcessSolutionFile(String solutionFileFullPath, PackageRestoreInputs restoreInputs)
2018-03-16T08:30:29.9869611Z at NuGet.CommandLine.RestoreCommand.d__37.MoveNext()
2018-03-16T08:30:29.9869813Z --- End of stack trace from previous location where exception was thrown ---
2018-03-16T08:30:29.9869995Z at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
2018-03-16T08:30:29.9870166Z at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2018-03-16T08:30:29.9870995Z at NuGet.CommandLine.RestoreCommand.d__30.MoveNext()
2018-03-16T08:30:29.9871164Z --- End of inner exception stack trace ---
2018-03-16T08:30:30.0446275Z ##[error]The nuget command failed with exit code(1) and error(System.AggregateException: One or more errors occurred. ---> NuGet.CommandLine.CommandLineException: Error parsing solution file at D:\a\ts.sln: Exception has been thrown by the target of an invocation. at NuGet.CommandLine.MsBuildUtility.GetAllProjectFileNamesWithMsBuild(String solutionFile, String msbuildPath) at NuGet.CommandLine.RestoreCommand.ProcessSolutionFile(String solutionFileFullPath, PackageRestoreInputs restoreInputs) at NuGet.CommandLine.RestoreCommand.d__37.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NuGet.CommandLine.RestoreCommand.d__30.MoveNext() --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at NuGet.CommandLine.Command.Execute() at NuGet.CommandLine.Program.MainCore(String workingDirectory, String[] args) ---> (Inner Exception #0) NuGet.CommandLine.CommandLineException: Error parsing solution file at D:\a\ts.sln: Exception has been thrown by the target of an invocation. at NuGet.CommandLine.MsBuildUtility.GetAllProjectFileNamesWithMsBuild(String solutionFile, String msbuildPath) at NuGet.CommandLine.RestoreCommand.ProcessSolutionFile(String solutionFileFullPath, PackageRestoreInputs restoreInputs) at NuGet.CommandLine.RestoreCommand.d__37.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NuGet.CommandLine.RestoreCommand.d__30.MoveNext()<---)
2018-03-16T08:30:30.0459326Z ##[error]Packages failed to restore
2018-03-16T08:30:30.0477190Z ##[section]Finishing: NuGet restore
Upvotes: 4
Views: 4771
Reputation: 601
What helped me was the issue described in https://github.com/NuGet/Home/issues/6918 and the workaround described from AndrewGretton.
Upvotes: 5