这是我的[完整代码](https://github.com/roroco/nuget-pack-raise-cannot-create-err),我只使用以下代码:
37 7a bc af 27 1c
并关注Dep.nuspec
//Ro/Dep/TestNuget.cs
namespace Dep
{
public class TestNuget
{
}
}
当我跟随并提出错误时:
<?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
答案 0 :(得分:0)
我找到解决方案,sudo apt install nuget -y
安装nuget 2,当我下载latest nuget.exe(4.1.0)并运行mono path/to/nuget.exe pack
时,它可以正常工作