蛋糕 NuGetPack 配置
Cake NuGetPack Configuration
我正在尝试使用 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.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
文件夹中搜索程序集。
如何在 Cake 中将 NuGetPack 构建配置设置为 Release?
您需要将以下命令行参数 -Prop Configuration=Release
添加到 nuget pack
命令:
var nuGetPackSettings = new NuGetPackSettings
{
BasePath = binDir + Directory(configuration),
OutputDirectory = nugetPackageDir,
ArgumentCustomization = args => args.Append("-Prop Configuration=" + configuration)
};
可以使用Properties
属性:
设置
var nuGetPackSettings = new NuGetPackSettings
{
BasePath = binDir + Directory(configuration),
OutputDirectory = nugetPackageDir,
Properties = new Dictionary<string, string>
{
{ "Configuration", configuration }
}
};
我正在尝试使用 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.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
文件夹中搜索程序集。
如何在 Cake 中将 NuGetPack 构建配置设置为 Release?
您需要将以下命令行参数 -Prop Configuration=Release
添加到 nuget pack
命令:
var nuGetPackSettings = new NuGetPackSettings
{
BasePath = binDir + Directory(configuration),
OutputDirectory = nugetPackageDir,
ArgumentCustomization = args => args.Append("-Prop Configuration=" + configuration)
};
可以使用Properties
属性:
var nuGetPackSettings = new NuGetPackSettings
{
BasePath = binDir + Directory(configuration),
OutputDirectory = nugetPackageDir,
Properties = new Dictionary<string, string>
{
{ "Configuration", configuration }
}
};