【发布时间】:2018-08-22 23:55:57
【问题描述】:
我有一个 Cake 自动构建脚本,用于构建各种配置的解决方案。我正在尝试编写一个将打包解决方案并将其发送到服务器的 Web 部署任务。为了使该过程更具可重复性且不那么脆弱,我选择将包存储在 C:/projectName 中。
使用 cake 和 DotNetCore,如何指定 Web Deploy 包 (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):错误 CS1660:无法将 lambda 表达式转换为类型“ProcessArgumentBuilder”,因为它不是委托类型
文档:https://cakebuild.net/api/Cake.Core.Tooling/ToolSettings/50AAB3A8 https://cakebuild.net/api/Cake.Common.Tools.DotNetCore.MSBuild/DotNetCoreMSBuildBuilder/
【问题讨论】: