Azure DevOps - 章鱼包应用程序:System.IO.IOException:参数不正确*

Azure DevOps - Package Application for Octopus: System.IO.IOException: The parameter is incorrect *

我正在尝试将我的应用程序打包成一个 zip 文件,以便将其发送到 Octopus。

日志如下所示:

2021-05-17T21:15:00.8077153Z D:\a\r1\a>dotnet "C:\hostedtoolcache\windows\octo.4.3213\x64\/octo.dll" pack "--id=KFPortal" "--format=Zip" "--version=1.0.19" "--compressionlevel=optimal" "--outFolder=D:\a\r1\a" "--basePath=D:\a\r1\a\_KFPortal-CI\drop.zip" "--overwrite=false" 
2021-05-17T21:15:05.3741444Z Setting Zip compression level to Optimal
2021-05-17T21:15:05.3940706Z Packing KFPortal version "1.0.19"...
2021-05-17T21:15:05.4077016Z Saving "KFPortal.1.0.19.zip" to "D:\a\r1\a"...
2021-05-17T21:15:05.4095140Z Adding files from "D:\a\r1\a\_KFPortal-CI\drop.zip" matching pattern "**"
2021-05-17T21:15:06.7197552Z 
2021-05-17T21:15:06.7200093Z System.IO.IOException: The parameter is incorrect : 'D:\a\r1\a\_KFPortal-CI\drop.zip'
2021-05-17T21:15:06.7200973Z    at System.IO.Enumeration.FileSystemEnumerator`1.GetData()
2021-05-17T21:15:06.7201594Z    at System.IO.Enumeration.FileSystemEnumerator`1.FindNextEntry()
2021-05-17T21:15:06.7202125Z    at System.IO.Enumeration.FileSystemEnumerator`1.MoveNext()
2021-05-17T21:15:06.7202656Z    at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
2021-05-17T21:15:06.7203234Z    at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source)
2021-05-17T21:15:06.7203850Z    at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
2021-05-17T21:15:06.7204507Z    at NuGet.Common.PathResolver.PerformWildcardSearch(String basePath, String searchPath, Boolean includeEmptyDirectories, String& normalizedBasePath)
2021-05-17T21:15:06.7205322Z    at NuGet.Common.PathResolver.PerformWildcardSearch(String basePath, String searchPath)
2021-05-17T21:15:06.7206400Z    at Octopus.Cli.Commands.Package.ZipPackageBuilder.BuildPackage(String basePath, IList`1 includes, ManifestMetadata metadata, String outFolder, Boolean overwrite, Boolean verboseInfo) in C:\buildAgent\work9bf0fca31007af\source\Octopus.Cli\Commands\Package\ZipPackageBuilder.cs:line 62
2021-05-17T21:15:06.7208001Z    at Octopus.Cli.Commands.Package.PackCommand.<>c__DisplayClass21_0.<Execute>b__0() in C:\buildAgent\work9bf0fca31007af\source\Octopus.Cli\Commands\Package\PackCommand.cs:line 167
2021-05-17T21:15:06.7208829Z    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
2021-05-17T21:15:06.7209379Z --- End of stack trace from previous location where exception was thrown ---
2021-05-17T21:15:06.7209871Z    at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
2021-05-17T21:15:06.7210349Z --- End of stack trace from previous location where exception was thrown ---
2021-05-17T21:15:06.7210984Z    at Octopus.Cli.CliProgram.Run(String[] args) in C:\buildAgent\work9bf0fca31007af\source\Octopus.Cli\CliProgram.cs:line 54
2021-05-17T21:15:06.7211497Z Exit code: -3
2021-05-17T21:15:06.7420731Z ##[error]Error: The process 'C:\hostedtoolcache\windows\octo.4.3213\x64\octo.cmd' failed with exit code 4294967293
2021-05-17T21:15:06.7437803Z ##[error]Failed to execute octo pack command. The process 'C:\hostedtoolcache\windows\octo.4.3213\x64\octo.cmd' failed with exit code 4294967293
2021-05-17T21:15:06.7489404Z ##[section]Finishing: Package KFPortal

这是我的配置

我做错了什么?

我认为真正的问题是您没有为托管代理下的项目设置正确的源路径

如果你的 repos 分支有名为 _KFPortal-CI 的文件夹,那么你应该将源路径设置为

$(System.DefaultWorkingDirectory)/_KFPortal-CI

够了,drop 文件夹来自 artifact 任务,仅临时存在于 Artifact 任务中,在 repos 下永远不存在。