我正在测试VSTS托管的NuGet提要,并创建了一个名为SomeComponent.2.1.0.npkg的提要,并将其发布到提要中。
我想重新测试我对发布定义所做的更改,所以我从提要中删除了包,并清空了回收站。
但是现在,当我试图发布时,我收到了错误:
Error: An unexpected error occurred while trying to push the package with VstsNuGetPush.exe. Exit code(1) and error(Error:
Microsoft.VisualStudio.Services.NuGet.WebApi.Exceptions.PackageExistsAsDeletedException: The version 2.1.0 of SomeComponent has been deleted. It cannot be restored or pushed.
at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.HandleResponse(HttpResponseMessage response)
at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.<SendAsync>d__47.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 Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.<SendAsync>d__29.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 VstsNuGetPush.PackageAdder.AddPackageToFeed(String feedName, BlobIdentifierWithBlocks blobId)
at VstsNuGetPush.VstsNuGetPushOperation.AddPackageToFeed(BlobIdentifierWithBlocks blobId)
at VstsNuGetPush.VstsNuGetPushOperation.Execute(Stream stream)
at VstsNuGetPush.VstsNuGetPushCommand.MainCore(ILogger logger)
at VstsNuGetPush.VstsNuGetPushCommand.Main())
Packages failed to publish如果我删除了这个包,并清空了回收箱,还有什么能保留我以前发布过的这个软件包呢?
而且,它为什么要关心我是否重新发布了一个软件包,难道我就不能覆盖那里的东西吗?
发布于 2018-06-27 03:32:39
它未能再次将已删除的nuget包推入VSTS提要,因为您的与已删除的包的版本相同。
这是一种保护机制,即相同版本的已删除包不应该再次推送,因为它可能会给已经使用包版本的项目造成混乱。下面有一个示例,如果删除的包可以再次被推送,会导致意外的结果:
假设project1使用的是带有版本2.1.0的nuget包SomeComponent。当您在VSTS提要中删除此包时,project1只会找到2.1.0版本为不可用的nuget包SomeComponent。但是,如果具有相同版本的SomeComponent (与已删除的2.1.0相比,.pkg具有完全不同的特性)的包可以再次推送,则会对project1造成意外的结果/错误。
因此,简单地说,应该为相同的nuget包推送一个与已删除版本不同的版本(例如,在上面的示例中,推SomeComponent包带有版本2.1.1 )。
https://stackoverflow.com/questions/51032778
复制相似问题