为什么NuGetPack会以“无法创建既没有依赖项也没有内容的程序包”响应? [英] Why does NuGetPack respond with "Cannot create a package that has no dependencies nor content"

查看:274
本文介绍了为什么NuGetPack会以“无法创建既没有依赖项也没有内容的程序包”响应?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下Cake脚本:

I am trying to use the following Cake script:

Task("Create-NuGet-Packages")
    .IsDependentOn("Build")
    .WithCriteria(() =>DirectoryExists(parameters.Paths.Directories.NugetNuspecDirectory))
    .Does(() =>
{
    var nuspecFiles = GetFiles(parameters.Paths.Directories.NugetNuspecDirectory + "/**/*.nuspec");

    EnsureDirectoryExists(parameters.Paths.Directories.NuGetPackages);

    foreach(var nuspecFile in nuspecFiles)
    {
        // TODO: Addin the release notes
        // ReleaseNotes = parameters.ReleaseNotes.Notes.ToArray(),

        // Create packages.
        NuGetPack(nuspecFile, new NuGetPackSettings {
            Version = parameters.Version.SemVersion,
            BasePath = parameters.Paths.Directories.PublishedLibraries.Combine(nuspecFile.GetFilenameWithoutExtension().ToString()),
            OutputDirectory = parameters.Paths.Directories.NuGetPackages,
            Symbols = false,
            NoPackageAnalysis = true
        });
    }
});

但我一直收到相同的错误:

But I keep getting the same error:

我已经确认生成的 *。temp.nuspec 文件确实包含正确的文件,并且这些文件存在于指定位置,并且BasePath是正确的。

I have confirmed that the generated *.temp.nuspec file does indeed contain the correct files, and that the files exist within the specified location, and that the BasePath is correct.

注意:我已使用 -Verbosity Diagnostic 生成要传递给NuGet.exe的实际命令,直接运行该命令也会导致相同的错误消息。因此,我认为这与Cake无关,而与NuGet.exe无关。

NOTE: I have used -Verbosity Diagnostic to generate the actual command that is being passed to NuGet.exe, and running that directly also results in the same error message. As a result, I don't think that this is a problem directly with Cake, but rather with NuGet.exe.

推荐答案

原来,这是我使用的目录路径的错误。我试图使用 .build\_temp\_PublishedLibraries\Cake.Twitter

Turns out, this was an error with the directory paths that I was using. I was trying to use .build\_temp\_PublishedLibraries\Cake.Twitter.

更改 .build BuildArtifacts 立即使一切正常:

Changing .build to BuildArtifacts immediately made everything work:

在进行了一些挖掘之后,这似乎是NuGet的一个已知问题(至少有些人知道):

After doing a little bit of digging, this seems to be a known issue with NuGet (well at least known to some):

https://twitter.com/ferventcoder/ status / 505048107520765952

ie任何以开头的文件或文件夹。不能被nuget包识别。

i.e. Any file or folder that start with a . are not recognised by nuget pack.

似乎此问题已得到纠正

注意:我在这里提出了一个问题: https://github.com/NuGet/Home/issues/3308

NOTE: I have raised this as an issue here: https://github.com/NuGet/Home/issues/3308

这篇关于为什么NuGetPack会以“无法创建既没有依赖项也没有内容的程序包”响应?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆