Question: How do I set a specific attribute in an XML file with FAKE?
I want to build a Windows Phone 8.1 project with the help of FAKE. The version tag is a parameter of the build script. The tag is already baked into the assemply info:
let version = getBuildParamOrDefault "version" "0.0.0.1"
Target "AssemblyInfo" (fun _ ->
CreateCSharpAssemblyInfo "./src/SharedAssemblyInfo.cs"
[
Attribute.Product product
Attribute.Version version
Attribute.FileVersion version
Attribute.Metadata ("githash", commitHash)
]
)
There is another file in a Windows Phone 8.1 project that contains version information: Package.appxmanifest.
<?xml version="1.0" encoding="utf-8"?>
<Package ...>
<Identity Name="..." Publisher="..." Version="1.0.0.0" />
...
</Package>
I want to change the value of the Version attribute of the Identity tag. It should contain the version tag given as build parameter. I want to do it in a separate target with the name "AppxManifest" and it should execute after manipulating the assembly info file but before the MSBuild build is executed:
Target "AppxManifest" (fun _ ->
???
)
"Clean"
==> "RestorePackages"
==> "AssemblyInfo"
==> "AppxManifest"
==> "Build"
I have found an XMLHelper in the documentation of FAKE (http://fsharp.github.io/FAKE/apidocs/fake-xmlhelper.html) and it looks like that this thing can do the job. But there are no examples. I could not figure out how to do it.