10

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

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
        });
    }
});

但我不断收到同样的错误:

从 NuGetPack 返回的错误

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

注意:我曾经-Verbosity Diagnostic生成传递给 NuGet.exe 的实际命令,并且直接运行它也会导致相同的错误消息。因此,我不认为这直接是 Cake 的问题,而是 NuGet.exe 的问题。

4

3 回答 3

6

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

更改.buildBuildArtifacts立即使一切正常:

在此处输入图像描述

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

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

即任何以a 开头的文件或文件夹.都不能被nuget pack 识别。

似乎这个问题已经在 Chocolatey 中得到纠正,因此,它在那里工作。

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

于 2016-08-12T06:40:07.433 回答
3

<file src如果您只是在属性中指定了错误的路径/规范并且 NuGet 不收集任何文件,也可以看到此错误。

于 2018-02-16T13:59:22.550 回答
2

在我的情况下,问题是使用正斜杠 / 而不是反斜杠 \ - 它可能与https://github.com/NuGet/Home/issues/3584有关

于 2020-07-09T16:48:35.957 回答