如何使用 Cake Builder 指定自定义参数? (点网核心)
How do I specify Custom Arguments with Cake Builder? (DotNetCore)
我有一个 Cake 自动构建脚本,用于构建各种配置的解决方案。我正在尝试编写一个 Web 部署任务来打包解决方案,并将其发送到服务器。为了使该过程更具可重复性且不那么脆弱,我选择将包存储在 C:/projectName 中。
使用 cake 和 DotNetCore,如何指定 Web 部署包 (zip) 输出文件夹?这是我目前所拥有的:
Task("DeployRelease")
.Does(() =>
{
foreach(var webConfig in config.projConfigs){
Debug($"Publishing website: {webConfig.WebsiteServer}");
DotNetCoreMSBuild(csprojPath, new DotNetCoreMSBuildSettings()
.WithProperty("DeployOnBuild","true")
.SetConfiguration(config.Configuration)
.ArgumentCustomization(args=>args.Append($"/OutputPath={webConfig.BuildPath}"));
var deploySettings = new DeploySettings()
{
SourcePath = webConfig.BuildPath,
SiteName = webConfig.WebsiteName,
ComputerName = webConfig.WebsiteServer,
Username = webConfig.DeployUser,
Password = webConfig.DeployToken
};
DeployWebsite(deploySettings);
Debug($"Completed Web Deploy on: {webConfig.WebsiteServer}");
}
});
上面的代码应该可以工作(至少在我解释文档时是这样)但是我收到以下错误:
C:/Development/{project}/build.{project}.cake(355,40): error CS1660: Cannot convert lambda expression to type 'ProcessArgumentBuilder' because it is not a delegate type
文档:https://cakebuild.net/api/Cake.Core.Tooling/ToolSettings/50AAB3A8
https://cakebuild.net/api/Cake.Common.Tools.DotNetCore.MSBuild/DotNetCoreMSBuildBuilder/
ArgumentCustomization 是所有工具设置的 属性,因此正确的语法是:
new DotNetCoreMSBuildSettings {
ArgumentCustomization = args=>args.Append($"/OutputPath={webConfig.BuildPath}")
}.WithProperty("DeployOnBuild","true")
.SetConfiguration(config.Configuration);
我有一个 Cake 自动构建脚本,用于构建各种配置的解决方案。我正在尝试编写一个 Web 部署任务来打包解决方案,并将其发送到服务器。为了使该过程更具可重复性且不那么脆弱,我选择将包存储在 C:/projectName 中。
使用 cake 和 DotNetCore,如何指定 Web 部署包 (zip) 输出文件夹?这是我目前所拥有的:
Task("DeployRelease")
.Does(() =>
{
foreach(var webConfig in config.projConfigs){
Debug($"Publishing website: {webConfig.WebsiteServer}");
DotNetCoreMSBuild(csprojPath, new DotNetCoreMSBuildSettings()
.WithProperty("DeployOnBuild","true")
.SetConfiguration(config.Configuration)
.ArgumentCustomization(args=>args.Append($"/OutputPath={webConfig.BuildPath}"));
var deploySettings = new DeploySettings()
{
SourcePath = webConfig.BuildPath,
SiteName = webConfig.WebsiteName,
ComputerName = webConfig.WebsiteServer,
Username = webConfig.DeployUser,
Password = webConfig.DeployToken
};
DeployWebsite(deploySettings);
Debug($"Completed Web Deploy on: {webConfig.WebsiteServer}");
}
});
上面的代码应该可以工作(至少在我解释文档时是这样)但是我收到以下错误:
C:/Development/{project}/build.{project}.cake(355,40): error CS1660: Cannot convert lambda expression to type 'ProcessArgumentBuilder' because it is not a delegate type
文档:https://cakebuild.net/api/Cake.Core.Tooling/ToolSettings/50AAB3A8 https://cakebuild.net/api/Cake.Common.Tools.DotNetCore.MSBuild/DotNetCoreMSBuildBuilder/
ArgumentCustomization 是所有工具设置的 属性,因此正确的语法是:
new DotNetCoreMSBuildSettings {
ArgumentCustomization = args=>args.Append($"/OutputPath={webConfig.BuildPath}")
}.WithProperty("DeployOnBuild","true")
.SetConfiguration(config.Configuration);