c# - 在 Linux 中,当我使用 nuget pack 时,它会引发 "Cannot create a package"

标签 c# linux nuget

这是我的[完整代码]( https://github.com/roroco/nuget-pack-raise-cannot-create-err ),我只用了下面的代码:

//Ro/Dep/TestNuget.cs

namespace Dep
{
    public class TestNuget
    {

    }
}

并遵循 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>

当我跟随并引发错误时:

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 

这是我的环境:

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

最佳答案

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

关于c# - 在 Linux 中,当我使用 nuget pack 时,它会引发 "Cannot create a package",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45758703/

相关文章:

linux - D-总线 : is there such a thing as a "D-Bus sniffer"?

cmd - Chocolatey Ngrok.portable 不工作

c# - 在递归公式中搜索位置函数

c# - 从 web.config 按名称读取 WCF 服务终结点地址

linux - 在 centOS 上,大量 float 的字符串流序列化比序列化 block 的 4 个 pthread-ts 更快。 std::threads 在 Windows 上更快

linux - grep -A <num> 直到一个字符串

.net - 证书无效的自定义 NuGet 提要

nuget - project.json 指定 NuGet 依赖项的确切版本

c# - 如何将EventsTab插入PropertyGrid?

c# - Chrome 显示 keyCode 未定义