Skip to content

Instantly share code, notes, and snippets.

@Slesa
Created July 1, 2013 09:02
Show Gist options
  • Save Slesa/5899421 to your computer and use it in GitHub Desktop.
Save Slesa/5899421 to your computer and use it in GitHub Desktop.
A FAKE target for a click once application
#I @"Tools\Fake"
#r "FakeLib.dll"
open Fake
let buildNumber =
if hasBuildParam "version" then getBuildParam "version" else
if isLocalBuild then "0" else
buildVersion
let version =
"0.9." + buildNumber + ".0"
// Directories
let binDir = @".\Binaries\"
let buildDir = binDir @@ @"build\" // Warning: duplicated in deploy part
let buildX86Dir = binDir @@ @"build.x86\" // Warning: duplicated in deploy part
let clickOnce = "." + binDir @@ @"clickonce"
let clickOnceDir = clickOnce @@ @"x64"
let clickOnceX86Dir = clickOnce @@ @"x86"
Target "ClickOnce" (fun _ ->
let cwd = System.IO.Directory.GetCurrentDirectory() + buildDir
Log "Current directory: " [ cwd ]
let nsdecl =(["", "urn:schemas-microsoft-com:asm.v1"; "asmv1","urn:schemas-microsoft-com:asm.v1"; "asmv2", "urn:schemas-microsoft-com:asm.v2"; "xsi", "http://www.w3.org/2001/XMLSchema-instance"])
let newver = @"//asmv1:assembly//asmv1:assemblyIdentity/@version"
XmlPokeNS @"MyApplication\Properties\app.manifest" nsdecl newver version
clickOnceReferences
|> MSBuild buildDir "Publish" (["ProductVersion", version; "Configuration","Release"; "Platform", "Any CPU"; "PublishDir", clickOnceDir; "ApplicationVersion", version])
|> Log "ClickOnce-Output: "
clickOnceReferences
|> MSBuild buildDir "Publish" (["ProductVersion", version; "Configuration","Release"; "Platform", "x86"; "PublishDir", clickOnceX86Dir; "ApplicationVersion", version])
|> Log "ClickOnce-Output: "
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment