Skip to content
This repository has been archived by the owner on Oct 11, 2021. It is now read-only.

"Part URI is empty." error when using LICENSE file without .txt extension #190

Open
vors opened this issue Jul 7, 2019 · 2 comments
Open

Comments

@vors
Copy link

vors commented Jul 7, 2019

That took me couple hours to figure out and I read much more nuget code then I wanted to. So here it is.

If you try to use the LICENSE file instead of LICENSE.txt (which suppose to be a valid option according to https://github.com/chocolatey/package-validator/wiki/LicenseFileMissing )

Please add the a file named LICENSE.txt. You can see the format for that file if you call choco new test and look at the generated file in test\tools\LICENSE.txt

This check also looks for LICENSE, LICENSE.md, NOTICE.txt, NOTICE, and NOTICE.md. Casing doesn't matter for validation.

Then when running choco pack you will get a cryptic error (here is --debug output)

Sending message 'PostRunMessage' out if there are subscribers...
Chocolatey had an error occur:
System.ArgumentException: Part URI is empty.
   at System.IO.Packaging.PackUriHelper.CreatePartUri(Uri partUri)
   at NuGet.PackageBuilder.CreatePart(Package package, String path, Stream sourceStream)
   at NuGet.PackageBuilder.WriteFiles(Package package)
   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.services.ChocolateyPackageService.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
@ferventcoder
Copy link
Member

@vors are you putting a link in the nuspec? You can't do that for internal files yet.

@vors
Copy link
Author

vors commented Sep 27, 2019

I don't quite remember all the context - I wish I'd capture more at the time :)
If I recall correctly, what happened in the package is that originally we only had a url link to the license. Then choco acceptance tests indicate that LICENSE file is missing. So I added it to the package (url is still present) and encountered this error. It was resolved by changing the name of the file to LICENSE.txt (url is still present).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants