用于构建应用程序的vsts . 但是在恢复时不断出错 . 在本地机器上一切正常 . 在vsts上恢复错误 .

这是构建配置 .

Global.Json文件

{
  "sdk": {
    "version": "2.1.401"
  }
}

一些参考

https://github.com/NuGet/Home/issues/5941 https://github.com/Microsoft/azure-pipelines-tasks/issues/2747

2018-12-10T01:28:18.4482197Z ##[section]Starting: Restore
2018-12-10T01:28:18.4488549Z ==============================================================================
2018-12-10T01:28:18.4488635Z Task         : .NET Core
2018-12-10T01:28:18.4488675Z Description  : Build, test, package, or publish a dotnet application, or run a custom dotnet command. For package commands, supports NuGet.org and authenticated feeds like Package Management and MyGet.
2018-12-10T01:28:18.4488739Z Version      : 2.144.3
2018-12-10T01:28:18.4488777Z Author       : Microsoft Corporation
2018-12-10T01:28:18.4488819Z Help         : [More Information](https://go.microsoft.com/fwlink/?linkid=832194)
2018-12-10T01:28:18.4488876Z ==============================================================================
2018-12-10T01:28:19.2733888Z [command]C:\Windows\system32\chcp.com 65001
2018-12-10T01:28:19.3329111Z Active code page: 65001
2018-12-10T01:28:19.3370119Z SYSTEMVSSCONNECTION exists true
2018-12-10T01:28:19.6492379Z SYSTEMVSSCONNECTION exists true
2018-12-10T01:28:21.5520856Z SYSTEMVSSCONNECTION exists true
2018-12-10T01:28:21.6026525Z Saving NuGet.config to a temporary config file.
2018-12-10T01:28:21.6079287Z Saving NuGet.config to a temporary config file.
2018-12-10T01:28:21.6215729Z [command]"C:\Program Files\dotnet\dotnet.exe" restore D:\a\1\s\src\PlayTimeX.EntityFrameworkCore\PlayTimeX.EntityFrameworkCore.csproj --configfile D:\a\1\Nuget\tempNuGet_4943.config --verbosity Detailed
2018-12-10T01:28:23.2436898Z 
2018-12-10T01:28:23.2463203Z Welcome to .NET Core!
2018-12-10T01:28:23.2463656Z ---------------------
2018-12-10T01:28:23.2463901Z Learn more about .NET Core: https://aka.ms/dotnet-docs
2018-12-10T01:28:23.2464089Z Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli-docs
2018-12-10T01:28:23.2464228Z 
2018-12-10T01:28:23.2464387Z Telemetry
2018-12-10T01:28:23.2464527Z ---------
2018-12-10T01:28:23.2464693Z The .NET Core tools collect usage data in order to help us improve your experience. The data is anonymous and doesn't include command-line arguments. The data is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.
2018-12-10T01:28:23.2465258Z 
2018-12-10T01:28:23.2465414Z Read more about .NET Core CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry
2018-12-10T01:28:23.2467775Z 
2018-12-10T01:28:23.2468200Z Configuring...
2018-12-10T01:28:23.2468355Z --------------
2018-12-10T01:28:23.2468512Z A command is running to populate your local package cache to improve restore speed and enable offline access. This command takes up to one minute to complete and only runs once.
2018-12-10T01:30:44.0527286Z Decompressing .......... 140247 ms
2018-12-10T01:31:54.5844020Z Expanding .........System.AggregateException: One or more errors occurred. (One or more errors occurred. (The process cannot access the file 'C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.razor.design\2.1.1\tools\Microsoft.AspNetCore.Razor.Language.dll' because it is being used by another process.)) (The process cannot access the file 'C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.razor.design\2.1.1\tools\Microsoft.AspNetCore.Razor.Language.dll' because it is being used by another process.) ---> System.IO.IOException: The process cannot access the file 'C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.razor.design\2.1.1\tools\Microsoft.AspNetCore.Razor.Language.dll' because it is being used by another process.
2018-12-10T01:31:54.5845003Z    at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
2018-12-10T01:31:54.5846397Z    at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
2018-12-10T01:31:54.5846507Z    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
2018-12-10T01:31:54.5846616Z    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
2018-12-10T01:31:54.5847830Z    at System.IO.File.Create(String path)
2018-12-10T01:31:54.5847905Z    at Microsoft.DotNet.Archive.IndexedArchive.CopyOperation.Execute()
2018-12-10T01:31:54.5847954Z    at Microsoft.DotNet.Archive.IndexedArchive.ExtractOperation.DoOperation()
2018-12-10T01:31:54.5848005Z    at Microsoft.DotNet.Archive.IndexedArchive.<>c__DisplayClass19_1.<Extract>b__0(ExtractOperation extractOperation)
2018-12-10T01:31:54.5848080Z    at System.Linq.Parallel.ForAllOperator`1.ForAllEnumerator`1.MoveNext(TInput& currentElement, Int32& currentKey)
2018-12-10T01:31:54.5848126Z    at System.Linq.Parallel.ForAllSpoolingTask`2.SpoolingWork()
2018-12-10T01:31:54.5848172Z    at System.Linq.Parallel.SpoolingTaskBase.Work()
2018-12-10T01:31:54.5848243Z    at System.Linq.Parallel.QueryTask.BaseWork(Object unused)
2018-12-10T01:31:54.5848289Z    at System.Linq.Parallel.QueryTask.RunTaskSynchronously(Object o)
2018-12-10T01:31:54.5848361Z    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
2018-12-10T01:31:54.5848433Z --- End of stack trace from previous location where exception was thrown ---
2018-12-10T01:31:54.5848480Z    at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
2018-12-10T01:31:54.5848525Z    --- End of inner exception stack trace ---
2018-12-10T01:31:54.5849173Z    at System.Linq.Parallel.QueryTaskGroupState.QueryEnd(Boolean userInitiatedDispose)
2018-12-10T01:31:54.5849236Z    at System.Linq.Parallel.SpoolingTask.SpoolForAll[TInputOutput,TIgnoreKey](QueryTaskGroupState groupState, PartitionedStream`2 partitions, TaskScheduler taskScheduler)
2018-12-10T01:31:54.5849312Z    at System.Linq.Parallel.MergeExecutor`1.Execute()
2018-12-10T01:31:54.5849373Z    at System.Linq.Parallel.MergeExecutor`1.Execute[TKey](PartitionedStream`2 partitions, Boolean ignoreOutput, ParallelMergeOptions options, TaskScheduler taskScheduler, Boolean isOrdered, CancellationState cancellationState, Int32 queryId)
2018-12-10T01:31:54.5850294Z    at System.Linq.Parallel.PartitionedStreamMerger`1.Receive[TKey](PartitionedStream`2 partitionedStream)
2018-12-10T01:31:54.5850360Z    at System.Linq.Parallel.ForAllOperator`1.WrapPartitionedStream[TKey](PartitionedStream`2 inputStream, IPartitionedStreamRecipient`1 recipient, Boolean preferStriping, QuerySettings settings)
2018-12-10T01:31:54.5850415Z    at System.Linq.Parallel.UnaryQueryOperator`2.UnaryQueryOperatorResults.ChildResultsRecipient.Receive[TKey](PartitionedStream`2 inputStream)
2018-12-10T01:31:54.5850493Z    at System.Linq.Parallel.ListQueryResults`1.GivePartitionedStream(IPartitionedStreamRecipient`1 recipient)
2018-12-10T01:31:54.5850547Z    at System.Linq.Parallel.UnaryQueryOperator`2.UnaryQueryOperatorResults.GivePartitionedStream(IPartitionedStreamRecipient`1 recipient)
2018-12-10T01:31:54.5850611Z    at System.Linq.Parallel.QueryOperator`1.GetOpenedEnumerator(Nullable`1 mergeOptions, Boolean suppressOrder, Boolean forEffect, QuerySettings querySettings)
2018-12-10T01:31:54.5850708Z    at System.Linq.Parallel.ForAllOperator`1.RunSynchronously()
2018-12-10T01:31:54.5850757Z    at System.Linq.ParallelEnumerable.ForAll[TSource](ParallelQuery`1 source, Action`1 action)
2018-12-10T01:31:54.5850808Z    at Microsoft.DotNet.Archive.IndexedArchive.Extract(String compressedArchivePath, String outputDirectory, IProgress`1 progress)
2018-12-10T01:31:54.5850883Z    at Microsoft.DotNet.Configurer.NuGetPackagesArchiver.ExtractArchive(String archiveDestination)
2018-12-10T01:31:54.5850929Z    at Microsoft.DotNet.Configurer.NuGetCachePrimer.PrimeCache()
2018-12-10T01:31:54.5850975Z    at Microsoft.DotNet.Configurer.DotnetFirstTimeUseConfigurer.Configure()
2018-12-10T01:31:54.5851067Z    at Microsoft.DotNet.Cli.Program.ConfigureDotNetForFirstTimeUse(INuGetCacheSentinel nugetCacheSentinel, IFirstTimeUseNoticeSentinel firstTimeUseNoticeSentinel, IAspNetCertificateSentinel aspNetCertificateSentinel, IFileSentinel toolPathSentinel, Boolean hasSuperUserAccess, DotnetFirstRunConfiguration dotnetFirstRunConfiguration, IEnvironmentProvider environmentProvider)
2018-12-10T01:31:54.5851452Z    at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, ITelemetry telemetryClient)
2018-12-10T01:31:54.5851529Z    at Microsoft.DotNet.Cli.Program.Main(String[] args)
2018-12-10T01:31:54.5851594Z ---> (Inner Exception #0) System.IO.IOException: The process cannot access the file 'C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.razor.design\2.1.1\tools\Microsoft.AspNetCore.Razor.Language.dll' because it is being used by another process.
2018-12-10T01:31:54.5851672Z    at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
2018-12-10T01:31:54.5851723Z    at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
2018-12-10T01:31:54.5851774Z    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
2018-12-10T01:31:54.5851865Z    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
2018-12-10T01:31:54.5851910Z    at System.IO.File.Create(String path)
2018-12-10T01:31:54.5851980Z    at Microsoft.DotNet.Archive.IndexedArchive.CopyOperation.Execute()
2018-12-10T01:31:54.5852027Z    at Microsoft.DotNet.Archive.IndexedArchive.ExtractOperation.DoOperation()
2018-12-10T01:31:54.5852076Z    at Microsoft.DotNet.Archive.IndexedArchive.<>c__DisplayClass19_1.<Extract>b__0(ExtractOperation extractOperation)
2018-12-10T01:31:54.5852153Z    at System.Linq.Parallel.ForAllOperator`1.ForAllEnumerator`1.MoveNext(TInput& currentElement, Int32& currentKey)
2018-12-10T01:31:54.5852200Z    at System.Linq.Parallel.ForAllSpoolingTask`2.SpoolingWork()
2018-12-10T01:31:54.5852245Z    at System.Linq.Parallel.SpoolingTaskBase.Work()
2018-12-10T01:31:54.5852317Z    at System.Linq.Parallel.QueryTask.BaseWork(Object unused)
2018-12-10T01:31:54.5852449Z    at System.Linq.Parallel.QueryTask.RunTaskSynchronously(Object o)
2018-12-10T01:31:54.5852500Z    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
2018-12-10T01:31:54.5852666Z --- End of stack trace from previous location where exception was thrown ---
2018-12-10T01:31:54.5852716Z    at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)<---
2018-12-10T01:31:54.5852747Z 
2018-12-10T01:31:54.6054617Z ##[error]Error: C:\Program Files\dotnet\dotnet.exe failed with return code: 1
2018-12-10T01:31:54.6070722Z ##[error]Packages failed to restore
2018-12-10T01:31:54.6122378Z ##[section]Finishing: Restore