1

我想使用cpack命令从“app.nuspec”文件构建一个独立的“app.nupkg”包。这是我的应用程序的目录树:

C:\CHOCO_REPO\APP
│   app.nuspec
│
├───bin
│       dist
│       Setup.exe
│
└───tools
        chocolateyinstall.ps1
        chocolateyuninstall.ps1

dist 文件(大小~2G)实际上就是程序。当我尝试运行时:

cpack app.nupgk

我得到:

bin\dist
Cannot access a closed stream

带调试选项:

cpack app.nuspec -d

我得到:

Attempting to build package from 'app.nuspec'.
bin\dist
Attempting to delete  file "C:\choco_repo\APP\app.nupkg".
Chocolatey had an error occur:
System.ObjectDisposedException: Can not access a closed Stream.
at System.IO.Compression.DeflateStream.EnsureNotDisposed()
at MS.Internal.IO.Packaging.CompressStream.Flush()
at MS.Internal.IO.Zip.ZipIOLocalFileBlock.FlushExposedStreams()
at MS.Internal.IO.Zip.ZipIOLocalFileBlock.UpdateReferences(Boolean closingFlag)
at MS.Internal.IO.Zip.ZipIOBlockManager.SaveContainer(Boolean closingFlag)
at MS.Internal.IO.Zip.ZipIOBlockManager.SaveStream(ZipIOLocalFileBlock blockRequestingFlush, Boolean closingFlag)
at MS.Internal.IO.Zip.ZipIOModeEnforcingStream.Dispose(Boolean disposing)
at System.IO.Stream.Close()
at System.IO.Packaging.PackagePart.Close()
at System.IO.Packaging.Package.DoClose(PackagePart p)
at System.IO.Packaging.Package.DoOperationOnEachPart(PartOperation operation)
at System.IO.Packaging.Package.System.IDisposable.Dispose()
at NuGet.PackageBuilder.Save(Stream stream)
at chocolatey.infrastructure.app.nuget.NugetPack.BuildPackage(PackageBuilder builder, IFileSystem fileSystem, String outputPath)
at chocolatey.infrastructure.app.services.NugetService.pack_run(ChocolateyConfiguration config)
at chocolatey.infrastructure.app.runners.GenericRunner.run(ChocolateyConfiguration config, Container container, Boolean isConsole, Action`1 parseArgs)
at chocolatey.infrastructure.app.runners.ConsoleApplication.run(String[] args, ChocolateyConfiguration config, Container container)
at chocolatey.console.Program.Main(String[] args)
Exiting with 1

有什么帮助吗?谢谢你

4

1 回答 1

0

可能是大小。NuGet 和 .NET 在可以放入包的大小方面存在一些限制。

它可能只是 Choco,但我对此表示怀疑,因为它是作为 AnyCPU 构建的,这意味着在 64 位时是 x64。

我见过一些人做了一些巧妙的事情来获取一个 6GB 的 iso 并将其拆分为多个包,这些包是主包的依赖项。

于 2016-03-31T16:59:08.273 回答