I would like to use Cake script to automate my build and publish process. I started some tests with local publish but I was unable to make my Cake script to use publish profile that I've created in Visual Studio. Is it possible at all?
Here is my publish profile file:
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<publishUrl>C:\Users\radoslaw.stolarczyk\Desktop\CakeWebSite</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
</PropertyGroup>
</Project>
And here are two versions of my cake script:
I tried to publish my website using pubslish profile (CakeProfile.pubxml). It's not working at all the website is published to the folder inside the project folder.
MSBuild("./CakeWebSite.sln", settings => settings.WithProperty("DeployOnBuild", "true") .WithProperty("PublishProfile", "CakeProfile"));
It didn't worked well so I tried to set the same properties as in publish file:
MSBuild("./CakeWebSite.sln", new MSBuildSettings() .WithProperty("WebPublishMethod", "FileSystem") .WithProperty("LastUsedBuildConfiguration", "Debug") .WithProperty("LastUsedPlatform", "Any CPU") .WithProperty("ExcludeApp_Data", "False") .WithProperty("publishUrl", cakePublishPath) .WithProperty("OutDir", cakePublishPath) .WithProperty("DeleteExistingFiles", "True")
Second option worked better but still not sa expected. The build output from Cake script is different then from Visual Studio publish option as you can see on the picture below:
Maybe it's not a big deal for example with Cake I got precompiledApp.config and with Visual studio I don't but still I would like to get the same output from both publish methods.
So my question is: Is it possible to use publish profile from Visual Studio in Cake script or to recive the same output (from Cake, and VS) and how?