nuget-package - Cake NuGetPack配置

标签 nuget-package cakebuild

我正在尝试使用Cake脚本创建NuGet包:

var configuration = Argument("configuration", "Release");

var binDir = Directory("./bin") ;
var nugetPackageDir = Directory("./artifacts");

var nugetFilePaths = GetFiles("./**/*.csproj").Concat(GetFiles("./**/*.nuspec"));

var nuGetPackSettings = new NuGetPackSettings
{   
  BasePath = binDir + Directory(configuration),
  OutputDirectory = nugetPackageDir  
};

Task("NuGetPack")
  .Does(() => NuGetPack(nugetFilePaths, nuGetPackSettings));

我收到以下错误:
========================================
NuGetPack
========================================
Executing task: NuGetPack
Attempting to build package from 'SomeProject.csproj'.
MSBuild auto-detection: using msbuild version '12.0' from 'C:\Program Files (x86)\MSBuild\12.0\bin'.
Unable to find 'C:\DEV\SomeProject\bin\Debug\SomeProject.dll'. Make sure the project has been built.
An error occured when executing task 'NuGetPack'.
Error: NuGet: Process returned an error (exit code 1).

它在Debug文件夹而不是Release文件夹中搜索程序集。
如何将NuGetPack构建配置设置为Cake中的Release?

最佳答案

您需要将以下命令行参数-Prop Configuration=Release添加到nuget pack命令:

var nuGetPackSettings = new NuGetPackSettings
{   
  BasePath = binDir + Directory(configuration),
  OutputDirectory = nugetPackageDir,
  ArgumentCustomization = args => args.Append("-Prop Configuration=" + configuration)
};

关于nuget-package - Cake NuGetPack配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37814627/

相关文章:

c++ - 无法打开包含文件 : 'cpprest/http_client.h'

nuget 覆盖文件

c# - 如何在vscode中调试cake项目?

git - 使用 Cake Build 创建远程存储库标签

c# - 文件packages.config.md5sum的用途

package - Nuget更新无法正常工作

nuget - 将 NuGet 包恢复到最新版本

asp.net - 无法加载文件或程序集 'System.Web.Optimization, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

macos - Cake 在 OS X 上构建失败,找不到 msbuild.exe