I have a Cake automated build script used to build a solution in various configurations. I am trying to write a Web Deploy task that will package up a solution, and send it to the server. To make the process more repeatable and less flimsy, I've opted to store the package in C:/projectName.
Using cake and DotNetCore, how can I specify a Web Deploy package (zip) output folder? Here is what I have so far:
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}");
}
});
The above code should work (at least as I interpreted the docs) but I get the following error:
C:/Development/{project}/build.{project}.cake(355,40): error CS1660: Cannot convert lambda expression to type 'ProcessArgumentBuilder' because it is not a delegate type
Docs: https://cakebuild.net/api/Cake.Core.Tooling/ToolSettings/50AAB3A8 https://cakebuild.net/api/Cake.Common.Tools.DotNetCore.MSBuild/DotNetCoreMSBuildBuilder/
ArgumentCustomization is a property on all tool settings, so correct syntax would be:
new DotNetCoreMSBuildSettings {
ArgumentCustomization = args=>args.Append($"/OutputPath={webConfig.BuildPath}")
}.WithProperty("DeployOnBuild","true")
.SetConfiguration(config.Configuration);