简体   繁体   中英

In Linux, when I use nuget pack, it raise “Cannot create a package”

here is my [full code]( https://github.com/roroco/nuget-pack-raise-cannot-create-err ), I only use following code:

//Ro/Dep/TestNuget.cs

namespace Dep
{
    public class TestNuget
    {

    }
}

and following Dep.nuspec

<?xml version="1.0"?>
<package >
  <metadata>
    <id>Ro.Dep</id>
    <version>1.0</version>
    <title>Dep</title>
    <authors>roroco</authors>
    <owners>roroco</owners>
    <licenseUrl>http://LICENSE_URL_HERE_OR_DELETE_THIS_LINE</licenseUrl>
    <projectUrl>http://PROJECT_URL_HERE_OR_DELETE_THIS_LINE</projectUrl>
    <iconUrl>http://ICON_URL_HERE_OR_DELETE_THIS_LINE</iconUrl>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>prpr</description>
    <releaseNotes>Summary of changes made in this release of the package.</releaseNotes>
    <copyright>Copyright 2017</copyright>
    <tags>Tag1 Tag2</tags>
  </metadata>
</package>

when I do following and raise err:

roroco@roroco ~/Downloads/test/cs/create-nuget-dep-and-use-it/Dep $ nuget pack -Verbosity detailed Dep.nuspec 
Attempting to build package from 'Dep.nuspec'.
System.InvalidOperationException: Cannot create a package that has no dependencies nor content.
  at NuGet.PackageBuilder.Save (System.IO.Stream stream) [0x0005b] in <0800978c21b14124ab3d9821cb98ed45>:0 
  at NuGet.Commands.PackCommand.BuildPackage (NuGet.PackageBuilder builder, System.String outputPath) [0x00088] in <e3902586c3ab4cf69b6ed7a8d575962f>:0 
  at NuGet.Commands.PackCommand.BuildFromNuspec (System.String path) [0x00054] in <e3902586c3ab4cf69b6ed7a8d575962f>:0 
  at NuGet.Commands.PackCommand.BuildPackage (System.String path) [0x00013] in <e3902586c3ab4cf69b6ed7a8d575962f>:0 
  at NuGet.Commands.PackCommand.ExecuteCommand () [0x000a5] in <e3902586c3ab4cf69b6ed7a8d575962f>:0 
  at NuGet.Commands.Command.Execute () [0x000ca] in <e3902586c3ab4cf69b6ed7a8d575962f>:0 
  at NuGet.Program.Main (System.String[] args) [0x0018b] in <e3902586c3ab4cf69b6ed7a8d575962f>:0 

here is my env:

roroco@roroco ~/Downloads/test/cs/create-nuget-dep-and-use-it/Dep $ lsb_release -a
No LSB modules are available.
Distributor ID: LinuxMint
Description:    Linux Mint 18 Sarah
Release:    18
Codename:   sarah

NuGet Version: 2.12.0.0

我找到了解决方案,当我下载最新的nuget.exe(4.1.0)并运行mono path/to/nuget.exe pack时, sudo apt install nuget -y install nuget 2,它可以工作

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM