Closed nsingh03 closed 8 years ago
Hi @nsingh03,
No worries, happy to assist.
You find our documentation on http://cakebuild.net The Getting Started is a good place to start. Under the DSL documentation many of the aliases has sample code on how they're just. If you find any issues with Cake or it's documentation, raising an issue here is correct way to go. We also have a Gitter chat room at https://gitter.im/cake-build/cake where you can get help from the Cake community .
If anything specific still is unclear ping us here in the issue, or close it if you found what you needed.
Thanks for your patience. I would need tons of help really before can re-create/migrate our entire wise based installer to cake build. So anytime I am really stuck is this the correct forum I can paste the query or somewhere else ? , it might not be an actual issue but the learning curve while working on cake build
Secondly "https://gitter.im/cake-build/cake " is not opening. Is this the correct URL for chat ?
Also right now we are creating .MSI packages for our deployments using wise. The same deployment script can be created using cakebuild I assume ?
Also there is a visual studio integration ofr cakebuild ? Is it stable enough to create deployment scripts ?
Gitter link should work but you could also try this button
@gep13 recently did a presentation, slides and sample code are at https://github.com/gep13/CakeDemos
Me and @gep13 also recently was on the MSDevShow Podcast, where we go thru some features and limitations of Cake, you can find that episode here: http://msdevshow.com/2016/04/cakebuild-with-mattias-karlsson-and-gary-ewan-park/
For creating installation we have som WiX aliases: http://cakebuild.net/dsl/wix See that those aren't very well documented, but basically if you're using WiX for your installs today it wraps those tools.
If you're using NSIS for your installers those aliases are documented here: http://cakebuild.net/dsl/nsis
Don't have any public sample project of those perhaps @patriksvensson or @vktr has that authored those aliases.
I personally use Sublime (with C# highlighting .cake files) or VSCode (there's an extension avail here that gives you syntax highlighting) to author my scripts, there's no extension for Visual Studio available yet.
I don't have any sample Cake+WiX projects, but here's the relevant bits from my script,
WiXCandle("./installer/CoolProject.wxs", new CandleSettings
{
Architecture = arch,
Defines = new Dictionary<string, string>
{
{ "Configuration", configuration },
{ "Platform", platform },
{ "Version", Version }
},
OutputDirectory = BuildDirectory
});
WiXLight(BuildDirectory + File("CoolProject.wixobj"), new LightSettings
{
OutputFile = BuildDirectory + File(Installer)
});
You'll need a dependency on the WiX.Toolset
package for this to work.
Thanks @vktr :+1:
Take me a bit to find some good example to use cake with wix. Finally I find my self looking this issue and the tests files...
For my use case, I converted my project from "build.proj" to "cake"
Thanks @vktr @nsingh03 @devlead
build.proj
<!-- Installer -->
<Target Name="Installer" DependsOnTargets="InstallerTransform">
<!--MSI-->
<Exec Command=""$(WixPath)\heat.exe" dir "$(DirOut)\Files" -dr WinhotelProgramDir -ke -srd -cg ProductComponents -var var.publishDir var.Version var.SemVersion -gg -out ..\Installer\PMS_UI.Installer\$(WixContentCode) -sreg -scom"
ContinueOnError="false"
WorkingDirectory="." />
<Exec Command=""$(WixPath)\candle.exe" -dpublishDir="$(DirOut)\Files" -dVersion="$(Version)" -dSemVersion="$(SemVersion)" -dWinhotelResourceDir=. @(WixCode, ' ')"
ContinueOnError="false"
WorkingDirectory="..\Installer\PMS_UI.Installer" />
<!--<Exec Command=""$(WixPath)\light.exe" -ext WixUIExtension -cultures:$(Culture) -out $(MsiOut) @(WixObject, ' ')"-->
<Exec Command=""$(WixPath)\light.exe" -ext WixUIExtension -cultures:$(Cultures) -loc .\Product_$(Cultures).wxl -out $(MsiOut) @(WixObject, ' ')"
ContinueOnError="false"
WorkingDirectory="..\Installer\PMS_UI.Installer" />
<!--<Delete Files="@(WixObject)" />-->
<Message Text="Installer has been created." />
</Target>
<!--End Installer-->
build.cake
#addin "Cake.FileHelpers"
#tool "nuget:?package=WiX.Toolset"
var target = Argument<string>("target", "Default");
var configuration = Argument<string>("Configuration", "Debug");
var targetEnvName = Argument<string>("targetEnvName", "Dev");
var semVersion = Argument<string>("targetVersion", "1.3.4");
var version = semVersion + "." + (EnvironmentVariable("TEAMCITY_BUILD_NUMBER") ?? "0");
var publishDir = "./output/" + targetEnvName;
var publishFilesDir = publishDir + "/Files";
var msiPath = publishDir + "/pms-setup-" + semVersion + ".msi";
var zipPath = publishDir + "/pms-" + semVersion + ".zip";
...
Task("Installer")
.IsDependentOn("Publish")
.Does(() =>
{
var installerPath = "../Installer/PMS_UI.Installer";
var contentWxs = installerPath + "/ProjectContent.wxs";
WiXHeat(publishFilesDir, contentWxs, WiXHarvestType.Dir, new HeatSettings
{
DirectoryReferenceId = "WinhotelProgramDir",
KeepEmptyDirectories = true,
SuppressRootDirectory = true,
ComponentGroupName = "ProductComponents",
GenerateGuid = true,
SuppressRegistry = true,
SuppressCom = true,
ArgumentCustomization = args=>args.Append("-var var.publishDir var.Version var.SemVersion")
});
var wxsFiles = GetFiles(installerPath + "/*.wxs");
WiXCandle(wxsFiles, new CandleSettings
{
// Architecture = arch,
WorkingDirectory = installerPath,
Defines = new Dictionary<string, string>
{
{ "publishDir", publishFilesDir },
//{ "Configuration", configuration },
//{ "Platform", platform },
{ "Version", version },
{ "SemVersion", semVersion },
{ "WinhotelResourceDir", "." }
},
});
var wobjFiles = GetFiles(installerPath + "/*.wixobj");
var culture = "en-us";
var prodCulturePath = installerPath + "/Product_" + culture + ".wxl";
WiXLight(wobjFiles, new LightSettings
{
Extensions = new[] { "WixUIExtension" },
RawArguments = "-cultures:" + culture + " -loc " + prodCulturePath,
OutputFile = msiPath
});
});
Hi there, first of all not really sure if posting the issue in the correct forum or not, so apology in advance., but this is the only place I can find on the whole internet to get my clarifications addressed regarding cake-build
thanks in advance for help.